* LaTeX export of images @ 2009-09-22 13:39 Francesco Pizzolante [not found] ` <87pr9jf68i.fsf-djc/iPCCuDYQheJpep6IedvLeJWuRmrY@public.gmane.org> 2009-09-29 9:28 ` Carsten Dominik 0 siblings, 2 replies; 16+ messages in thread From: Francesco Pizzolante @ 2009-09-22 13:39 UTC (permalink / raw) To: mailing-list-org-mode Hi, I have a question about the LaTeX export of images. I wondering why we treat differently images with caption/label than the ones that do not have caption/label. I suppose that we want to make the difference between images that appear in the middle of the text and those who will appear in a float (with possibly label and caption). 1) Images in the middle of the text If I have the following example: ,---- | For this example, I will use this image [[myimage.png]] which is a very good one. `---- Then, when exported, it produces the following LaTeX code: ,---- | For this example, I will the use this image | \centerline{\includegraphics{myimage}} which is a very good one. `---- Which produces weird layout when compiled to PDF. In this case, we should just generate \includegraphics{myimage} without the centerline command. 2) Images in floats In the case of floats, the correct generated code should be something like: \begin{figure}[htb] \centering \includegraphics{myimage} \label{LABEL} \caption{CAPTION} \end{figure} and not \begin{figure}[htb] \centerline{\includegraphics{myimage}} \label{LABEL} \caption{CAPTION} \end{figure} This can also be fixed quickly I think. Now, the question is: is it correct to identify a "float" image thanks to its caption and label attributes? Can't we have a "float" image without label or caption? Thanks for your help and input. Francesco _______________________________________________ Emacs-orgmode mailing list Remember: use `Reply All' to send replies to the list. Emacs-orgmode-mXXj517/zsQ@public.gmane.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode ^ permalink raw reply [flat|nested] 16+ messages in thread
[parent not found: <87pr9jf68i.fsf-djc/iPCCuDYQheJpep6IedvLeJWuRmrY@public.gmane.org>]
* Re: LaTeX export of images [not found] ` <87pr9jf68i.fsf-djc/iPCCuDYQheJpep6IedvLeJWuRmrY@public.gmane.org> @ 2009-09-23 14:04 ` Sébastien Vauban 2009-09-23 15:30 ` Jeff Kowalczyk 0 siblings, 1 reply; 16+ messages in thread From: Sébastien Vauban @ 2009-09-23 14:04 UTC (permalink / raw) To: Francesco Pizzolante; +Cc: mailing-list-org-mode Hi Francesco, Francesco Pizzolante wrote: > 1) Images in the middle of the text > > If I have the following example: > > ,---- > | For this example, I will use this image [[myimage.png]] which is a very good one. > `---- > > Then, when exported, it produces the following LaTeX code: > > ,---- > | For this example, I will the use this image > | \centerline{\includegraphics{myimage}} which is a very good one. > `---- > > Which produces weird layout when compiled to PDF. > > In this case, we should just generate \includegraphics{myimage} without the > centerline command. Given the output of the `\centerline' command, I guess that the inlining of an image inside a line of text is not supported as is by Org. I can second such a choice. For such an effect, then, you still have a solution: simply write a chunk of LaTeX code in your Org file. > 2) Images in floats > > In the case of floats, the correct generated code should be something like: > > \begin{figure}[htb] > \centering > \includegraphics{myimage} > \label{LABEL} > \caption{CAPTION} > \end{figure} > > and not > > \begin{figure}[htb] > \centerline{\includegraphics{myimage}} > \label{LABEL} > \caption{CAPTION} > \end{figure} > > This can also be fixed quickly I think. I'm not really aware of the `\centerline' command in LaTeX. It's true that, in order to center, the most commonly usages are: - the `\centering' command, to be put inside a group, or - the `center' environment -- but this is generally considered as evil, as it adds unwanted spaces around. > Now, the question is: is it correct to identify a "float" image thanks to its > caption and label attributes? Can't we have a "float" image without label or > caption? That's right that I generally would also like to have all figures exported as floats (or, at least, that such a decision would not just depend on the presence or absence of a label/caption). Best regards, Seb -- Sébastien Vauban _______________________________________________ Emacs-orgmode mailing list Remember: use `Reply All' to send replies to the list. Emacs-orgmode-mXXj517/zsQ@public.gmane.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: LaTeX export of images 2009-09-23 14:04 ` Sébastien Vauban @ 2009-09-23 15:30 ` Jeff Kowalczyk 2009-09-23 21:09 ` Sébastien Vauban 0 siblings, 1 reply; 16+ messages in thread From: Jeff Kowalczyk @ 2009-09-23 15:30 UTC (permalink / raw) To: emacs-orgmode Sébastien Vauban <wxhgmqzgwmuf@...> writes: > Francesco Pizzolante wrote: > > In this case, we should just generate \includegraphics{myimage} without the > > centerline command. > > Given the output of the `\centerline' command, I guess that the inlining of an > image inside a line of text is not supported as is by Org. I can second such a > choice. +1 for default to inline graphics. When using Org for How-To and project documentation delivered as PDF, floating screenshot-size images typically situate far from the descriptive text. I would prefer inline images by default (or option), and a file/subtree level option to use LaTeX floating layout. Thanks, Jeff ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: LaTeX export of images 2009-09-23 15:30 ` Jeff Kowalczyk @ 2009-09-23 21:09 ` Sébastien Vauban 2009-09-29 9:30 ` Carsten Dominik 2009-10-02 6:55 ` Carsten Dominik 0 siblings, 2 replies; 16+ messages in thread From: Sébastien Vauban @ 2009-09-23 21:09 UTC (permalink / raw) To: emacs-orgmode-mXXj517/zsQ Jeff Kowalczyk wrote: > Sébastien Vauban <wxhgmqzgwmuf@...> writes: >> Francesco Pizzolante wrote: >>> In this case, we should just generate \includegraphics{myimage} without >>> the centerline command. >> >> Given the output of the `\centerline' command, I guess that the inlining of >> an image inside a line of text is not supported as is by Org. I can second >> such a choice. > > +1 for default to inline graphics. When using Org for How-To and project > documentation delivered as PDF, floating screenshot-size images typically > situate far from the descriptive text. My point was mainly that, IMHO, floating or not should not be tied to the presence or absence of caption/label. Your problem with screenshots far away should be solved by putting the H specifier to the float environment and loading the `float' package. > I would prefer inline images by default (or option), and a file/subtree > level option to use LaTeX floating layout. That'd be a great way to be able to specify which type of "inlining" we want. On a per file basis seems sufficient for me. Best regards, Seb -- Sébastien Vauban _______________________________________________ Emacs-orgmode mailing list Remember: use `Reply All' to send replies to the list. Emacs-orgmode-mXXj517/zsQ@public.gmane.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Re: LaTeX export of images 2009-09-23 21:09 ` Sébastien Vauban @ 2009-09-29 9:30 ` Carsten Dominik 2009-10-02 6:55 ` Carsten Dominik 1 sibling, 0 replies; 16+ messages in thread From: Carsten Dominik @ 2009-09-29 9:30 UTC (permalink / raw) To: Sébastien Vauban; +Cc: emacs-orgmode On Sep 23, 2009, at 11:09 PM, Sébastien Vauban wrote: > Jeff Kowalczyk wrote: >> Sébastien Vauban <wxhgmqzgwmuf@...> writes: >>> Francesco Pizzolante wrote: >>>> In this case, we should just generate \includegraphics{myimage} >>>> without >>>> the centerline command. >>> >>> Given the output of the `\centerline' command, I guess that the >>> inlining of >>> an image inside a line of text is not supported as is by Org. I >>> can second >>> such a choice. >> >> +1 for default to inline graphics. When using Org for How-To and >> project >> documentation delivered as PDF, floating screenshot-size images >> typically >> situate far from the descriptive text. > > My point was mainly that, IMHO, floating or not should not be tied > to the > presence or absence of caption/label. > > Your problem with screenshots far away should be solved by putting > the H > specifier to the float environment and loading the `float' package. > > >> I would prefer inline images by default (or option), and a file/ >> subtree >> level option to use LaTeX floating layout. > > That'd be a great way to be able to specify which type of "inlining" > we want. > On a per file basis seems sufficient for me. Hi Sebastien, how about working out a detailed proposal how this should work? - Carsten ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Re: LaTeX export of images 2009-09-23 21:09 ` Sébastien Vauban 2009-09-29 9:30 ` Carsten Dominik @ 2009-10-02 6:55 ` Carsten Dominik 2009-10-02 13:04 ` Darlan Cavalcante Moreira 1 sibling, 1 reply; 16+ messages in thread From: Carsten Dominik @ 2009-10-02 6:55 UTC (permalink / raw) To: Sébastien Vauban; +Cc: emacs-orgmode On Sep 23, 2009, at 11:09 PM, Sébastien Vauban wrote: > Jeff Kowalczyk wrote: >> Sébastien Vauban <wxhgmqzgwmuf@...> writes: >>> Francesco Pizzolante wrote: >>>> In this case, we should just generate \includegraphics{myimage} >>>> without >>>> the centerline command. >>> >>> Given the output of the `\centerline' command, I guess that the >>> inlining of >>> an image inside a line of text is not supported as is by Org. I >>> can second >>> such a choice. >> >> +1 for default to inline graphics. When using Org for How-To and >> project >> documentation delivered as PDF, floating screenshot-size images >> typically >> situate far from the descriptive text. > > My point was mainly that, IMHO, floating or not should not be tied > to the > presence or absence of caption/label. I don't understand why not. Can you try to explain again? Thanks. - Carsten > > Your problem with screenshots far away should be solved by putting > the H > specifier to the float environment and loading the `float' package. Maybe we need a way to specify the figure placement argument in # +LaTeX_ATTR: Do we need to implement a way so that text can be made to flow around a figure, just as it is possible in HTML export? What would be the right LaTeX package to use for this purpose? Thanks. - Carsten > > >> I would prefer inline images by default (or option), and a file/ >> subtree >> level option to use LaTeX floating layout. > > That'd be a great way to be able to specify which type of "inlining" > we want. > On a per file basis seems sufficient for me. > > Best regards, > Seb > > -- > Sébastien Vauban > > > > _______________________________________________ > Emacs-orgmode mailing list > Remember: use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Re: LaTeX export of images 2009-10-02 6:55 ` Carsten Dominik @ 2009-10-02 13:04 ` Darlan Cavalcante Moreira 2009-10-02 15:23 ` Nick Dokos 0 siblings, 1 reply; 16+ messages in thread From: Darlan Cavalcante Moreira @ 2009-10-02 13:04 UTC (permalink / raw) To: Carsten Dominik; +Cc: Sébastien Vauban, emacs-orgmode At Fri, 2 Oct 2009 08:55:22 +0200, Carsten Dominik wrote: > > > On Sep 23, 2009, at 11:09 PM, Sébastien Vauban wrote: > > > Jeff Kowalczyk wrote: > >> Sébastien Vauban <wxhgmqzgwmuf@...> writes: > >>> Francesco Pizzolante wrote: > >>>> In this case, we should just generate \includegraphics{myimage} > >>>> without > >>>> the centerline command. > >>> > >>> Given the output of the `\centerline' command, I guess that the > >>> inlining of > >>> an image inside a line of text is not supported as is by Org. I > >>> can second > >>> such a choice. > >> > >> +1 for default to inline graphics. When using Org for How-To and > >> project > >> documentation delivered as PDF, floating screenshot-size images > >> typically > >> situate far from the descriptive text. > > > > My point was mainly that, IMHO, floating or not should not be tied > > to the > > presence or absence of caption/label. > > I don't understand why not. Can you try to explain again? > > Thanks. > > - Carsten > > > > > > Your problem with screenshots far away should be solved by putting > > the H > > specifier to the float environment and loading the `float' package. > > Maybe we need a way to specify the figure placement argument in # > +LaTeX_ATTR: > > Do we need to implement a way so that text can be made to flow around > a figure, just as it is possible in HTML export? What would be the > right LaTeX package to use for this purpose? > > Thanks. > > - Carsten > > > > > > > >> I would prefer inline images by default (or option), and a file/ > >> subtree > >> level option to use LaTeX floating layout. > > > > That'd be a great way to be able to specify which type of "inlining" > > we want. > > On a per file basis seems sufficient for me. > > > > Best regards, > > Seb > > > > -- > > Sébastien Vauban > > > > > > > > _______________________________________________ > > Emacs-orgmode mailing list > > Remember: use `Reply All' to send replies to the list. > > Emacs-orgmode@gnu.org > > http://lists.gnu.org/mailman/listinfo/emacs-orgmode > > > > _______________________________________________ > Emacs-orgmode mailing list > Remember: use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode The Latex wikibook http://en.wikibooks.org/wiki/LaTeX/Floats,_Figures_and_Captions#Wrapping_text_around_figures suggests the wrapfigure package, but it also warns that some manual adjustments is often required. Therefore, if this is implemented in the latex exporter it is probably a good idea to provide options to include latex commands that will be put before and after the \includegraphics command. See the example in the section "Tip for figures with too much white space" of the wikibook where some \vspace were used to adjust white space around the figure. -- Darlan Cavalcante Moreira darcamo@gmail.com ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Re: LaTeX export of images 2009-10-02 13:04 ` Darlan Cavalcante Moreira @ 2009-10-02 15:23 ` Nick Dokos 2009-10-03 7:05 ` Carsten Dominik 0 siblings, 1 reply; 16+ messages in thread From: Nick Dokos @ 2009-10-02 15:23 UTC (permalink / raw) To: Darlan Cavalcante Moreira Cc: Sébastien Vauban, emacs-orgmode, Carsten Dominik Darlan Cavalcante Moreira <darcamo@gmail.com> wrote: > At Fri, 2 Oct 2009 08:55:22 +0200, > Carsten Dominik wrote: > > Do we need to implement a way so that text can be made to flow around > > a figure, just as it is possible in HTML export? What would be the > > right LaTeX package to use for this purpose? > > > The Latex wikibook > http://en.wikibooks.org/wiki/LaTeX/Floats,_Figures_and_Captions#Wrapping_text_around_figures > suggests the wrapfigure package, but it also warns that some manual adjustments > is often required. Therefore, if this is implemented in the latex exporter it is > probably a good idea to provide options to include latex commands that will be > put before and after the \includegraphics command. See the example in the > section "Tip for figures with too much white space" of the wikibook where some > \vspace were used to adjust white space around the figure. > ... and the TeX FAQ seems to agree that wrapfig is probably the best option: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=textflow It also mentions some additional limitations. Nick ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Re: LaTeX export of images 2009-10-02 15:23 ` Nick Dokos @ 2009-10-03 7:05 ` Carsten Dominik 2009-10-05 14:19 ` Darlan Cavalcante Moreira [not found] ` <B2499F80-4D9D-4F76-9432-ACF04E38C8EE-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 0 siblings, 2 replies; 16+ messages in thread From: Carsten Dominik @ 2009-10-03 7:05 UTC (permalink / raw) To: nicholas.dokos; +Cc: Sébastien Vauban, emacs-orgmode On Oct 2, 2009, at 5:23 PM, Nick Dokos wrote: > Darlan Cavalcante Moreira <darcamo@gmail.com> wrote: > >> At Fri, 2 Oct 2009 08:55:22 +0200, >> Carsten Dominik wrote: >>> Do we need to implement a way so that text can be made to flow >>> around >>> a figure, just as it is possible in HTML export? What would be the >>> right LaTeX package to use for this purpose? >>> >> The Latex wikibook >> http://en.wikibooks.org/wiki/LaTeX/Floats,_Figures_and_Captions#Wrapping_text_around_figures >> suggests the wrapfigure package, but it also warns that some manual >> adjustments >> is often required. Therefore, if this is implemented in the latex >> exporter it is >> probably a good idea to provide options to include latex commands >> that will be >> put before and after the \includegraphics command. See the example >> in the >> section "Tip for figures with too much white space" of the wikibook >> where some >> \vspace were used to adjust white space around the figure. >> > > ... and the TeX FAQ seems to agree that wrapfig is probably the best > option: > > http://www.tex.ac.uk/cgi-bin/texfaq2html?label=textflow > > It also mentions some additional limitations. > > Nick > OK, I have now modified image placement in LaTeX. 1. Image in text [[./img/x.png]] 2. Floating image with caption and modified size and placement #+CAPTION: My caption #+ATTR_LATEX: placement=[H] width=0.6\textwidth [[./img/x.png]] 3. Wrapping text around the image #+ATTR_LaTeX: wrap #+ATTR_HTML: align="left" [[./img/x.png]] 4. Wrapping text around the image with modified size and wrapfigure placement #+ATTR_LaTeX: wrap width=0.38\textwidth placement={r}{0.4\textwidth #+ATTR_HTML: align="right" width="250" [[./img/x.png]] Even if there is a caption, wrap will work and force the image to be non-floating with text wrapped around. Comments? - Carsten P.S. if you have customized org-export-latex-classes, you might have to undo, then redo this customization, or add the float and wrapfigure environments by hand to all classes you want to use. ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Re: LaTeX export of images 2009-10-03 7:05 ` Carsten Dominik @ 2009-10-05 14:19 ` Darlan Cavalcante Moreira [not found] ` <B2499F80-4D9D-4F76-9432-ACF04E38C8EE-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 1 sibling, 0 replies; 16+ messages in thread From: Darlan Cavalcante Moreira @ 2009-10-05 14:19 UTC (permalink / raw) To: Carsten Dominik; +Cc: Sébastien Vauban, emacs-orgmode At Sat, 3 Oct 2009 09:05:38 +0200, Carsten Dominik wrote: > > > On Oct 2, 2009, at 5:23 PM, Nick Dokos wrote: > > > Darlan Cavalcante Moreira <darcamo@gmail.com> wrote: > > > >> At Fri, 2 Oct 2009 08:55:22 +0200, > >> Carsten Dominik wrote: > >>> Do we need to implement a way so that text can be made to flow > >>> around > >>> a figure, just as it is possible in HTML export? What would be the > >>> right LaTeX package to use for this purpose? > >>> > >> The Latex wikibook > >> http://en.wikibooks.org/wiki/LaTeX/Floats,_Figures_and_Captions#Wrapping_text_around_figures > >> suggests the wrapfigure package, but it also warns that some manual > >> adjustments > >> is often required. Therefore, if this is implemented in the latex > >> exporter it is > >> probably a good idea to provide options to include latex commands > >> that will be > >> put before and after the \includegraphics command. See the example > >> in the > >> section "Tip for figures with too much white space" of the wikibook > >> where some > >> \vspace were used to adjust white space around the figure. > >> > > > > ... and the TeX FAQ seems to agree that wrapfig is probably the best > > option: > > > > http://www.tex.ac.uk/cgi-bin/texfaq2html?label=textflow > > > > It also mentions some additional limitations. > > > > Nick > > > > > OK, I have now modified image placement in LaTeX. > > 1. Image in text > > [[./img/x.png]] > > 2. Floating image with caption and modified size and placement > > #+CAPTION: My caption > #+ATTR_LATEX: placement=[H] width=0.6\textwidth > [[./img/x.png]] > > 3. Wrapping text around the image > > #+ATTR_LaTeX: wrap > #+ATTR_HTML: align="left" > [[./img/x.png]] > > 4. Wrapping text around the image with modified size and wrapfigure > placement > > #+ATTR_LaTeX: wrap width=0.38\textwidth placement={r}{0.4\textwidth > #+ATTR_HTML: align="right" width="250" > [[./img/x.png]] > > Even if there is a caption, wrap will work and force the > image to be non-floating with text wrapped around. > > Comments? > > - Carsten > > P.S. if you have customized org-export-latex-classes, you might have > to undo, then redo this customization, or add the float and wrapfigure > environments by hand > to all classes you want to use. > > I haven't tested it yet, but this seems to the best way to do it. Thanks Carsten. -- Darlan Cavalcante Moreira darcamo@gmail.com ^ permalink raw reply [flat|nested] 16+ messages in thread
[parent not found: <B2499F80-4D9D-4F76-9432-ACF04E38C8EE-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* Re: Re: LaTeX export of images [not found] ` <B2499F80-4D9D-4F76-9432-ACF04E38C8EE-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> @ 2009-10-13 10:03 ` Francesco Pizzolante 2009-10-20 10:18 ` Carsten Dominik 0 siblings, 1 reply; 16+ messages in thread From: Francesco Pizzolante @ 2009-10-13 10:03 UTC (permalink / raw) To: Carsten Dominik; +Cc: emacs-orgmode-mXXj517/zsQ Hi Carsten, Sorry for my late reply on this subject. > OK, I have now modified image placement in LaTeX. > > 1. Image in text > > [[./img/x.png]] > > 2. Floating image with caption and modified size and placement > > #+CAPTION: My caption > #+ATTR_LATEX: placement=[H] width=0.6\textwidth > [[./img/x.png]] > > 3. Wrapping text around the image > > #+ATTR_LaTeX: wrap > #+ATTR_HTML: align="left" > [[./img/x.png]] > > 4. Wrapping text around the image with modified size and wrapfigure placement > > #+ATTR_LaTeX: wrap width=0.38\textwidth placement={r}{0.4\textwidth > #+ATTR_HTML: align="right" width="250" > [[./img/x.png]] > > Even if there is a caption, wrap will work and force the > image to be non-floating with text wrapped around. > > Comments? I did not test the wrap option yet, but the rest is perfect (images in text, placements, width, captions, labels). I still miss one single option: "float" in order to force the centered figure environment if if no caption/label is present. I would add something like #+ATTR_LATEX: float or #+ATTR_LATEX: float=t Is this feasible? Thanks a lot! Francesco _______________________________________________ Emacs-orgmode mailing list Remember: use `Reply All' to send replies to the list. Emacs-orgmode-mXXj517/zsQ@public.gmane.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Re: LaTeX export of images 2009-10-13 10:03 ` Francesco Pizzolante @ 2009-10-20 10:18 ` Carsten Dominik 0 siblings, 0 replies; 16+ messages in thread From: Carsten Dominik @ 2009-10-20 10:18 UTC (permalink / raw) To: Francesco Pizzolante; +Cc: emacs-orgmode On Oct 13, 2009, at 12:03 PM, Francesco Pizzolante wrote: > Hi Carsten, > > Sorry for my late reply on this subject. > >> OK, I have now modified image placement in LaTeX. >> >> 1. Image in text >> >> [[./img/x.png]] >> >> 2. Floating image with caption and modified size and placement >> >> #+CAPTION: My caption >> #+ATTR_LATEX: placement=[H] width=0.6\textwidth >> [[./img/x.png]] >> >> 3. Wrapping text around the image >> >> #+ATTR_LaTeX: wrap >> #+ATTR_HTML: align="left" >> [[./img/x.png]] >> >> 4. Wrapping text around the image with modified size and wrapfigure >> placement >> >> #+ATTR_LaTeX: wrap width=0.38\textwidth placement={r}{0.4\textwidth >> #+ATTR_HTML: align="right" width="250" >> [[./img/x.png]] >> >> Even if there is a caption, wrap will work and force the >> image to be non-floating with text wrapped around. >> >> Comments? > > I did not test the wrap option yet, but the rest is perfect (images > in text, > placements, width, captions, labels). > > I still miss one single option: "float" in order to force the > centered figure > environment if if no caption/label is present. > > I would add something like > > #+ATTR_LATEX: float Have you actually tried? The following works for me. #+ATTR_LaTeX: float [[./blue_1.png]] This is text - Carsten > > or > > #+ATTR_LATEX: float=t > > Is this feasible? > > Thanks a lot! > > Francesco - Carsten ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: LaTeX export of images 2009-09-22 13:39 LaTeX export of images Francesco Pizzolante [not found] ` <87pr9jf68i.fsf-djc/iPCCuDYQheJpep6IedvLeJWuRmrY@public.gmane.org> @ 2009-09-29 9:28 ` Carsten Dominik 2009-09-29 19:32 ` Nick Dokos 1 sibling, 1 reply; 16+ messages in thread From: Carsten Dominik @ 2009-09-29 9:28 UTC (permalink / raw) To: Francesco Pizzolante; +Cc: mailing-list-org-mode On Sep 22, 2009, at 3:39 PM, Francesco Pizzolante wrote: > Hi, > > I have a question about the LaTeX export of images. > > I wondering why we treat differently images with caption/label than > the ones > that do not have caption/label. > > I suppose that we want to make the difference between images that > appear in > the middle of the text and those who will appear in a float (with > possibly > label and caption). > > > 1) Images in the middle of the text > > If I have the following example: > > ,---- > | For this example, I will use this image [[myimage.png]] which > is a very good one. > `---- > > Then, when exported, it produces the following LaTeX code: > > ,---- > | For this example, I will the use this image > | \centerline{\includegraphics{myimage}} which is a very good one. > `---- > > Which produces weird layout when compiled to PDF. > > In this case, we should just generate \includegraphics{myimage} > without the > centerline command. > > > 2) Images in floats > > In the case of floats, the correct generated code should be > something like: > > \begin{figure}[htb] > \centering > \includegraphics{myimage} > \label{LABEL} > \caption{CAPTION} > \end{figure} > > and not > > \begin{figure}[htb] > \centerline{\includegraphics{myimage}} > \label{LABEL} > \caption{CAPTION} > \end{figure} > > This can also be fixed quickly I think. Yes sure, but what is wrong with \centerline? does the \centering lead to a different result? - Carsten > > Now, the question is: is it correct to identify a "float" image > thanks to its > caption and label attributes? Can't we have a "float" image without > label or > caption? > > > Thanks for your help and input. > > Francesco > > > _______________________________________________ > Emacs-orgmode mailing list > Remember: use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: LaTeX export of images 2009-09-29 9:28 ` Carsten Dominik @ 2009-09-29 19:32 ` Nick Dokos 2009-09-30 7:30 ` Carsten Dominik [not found] ` <8809.1254252762-/Z0n3E7Cx4uRQBexplnFlPegYHeGw8Jk@public.gmane.org> 0 siblings, 2 replies; 16+ messages in thread From: Nick Dokos @ 2009-09-29 19:32 UTC (permalink / raw) To: Carsten Dominik; +Cc: mailing-list-org-mode Carsten Dominik <carsten.dominik@gmail.com> wrote: > > 1) Images in the middle of the text > > > > If I have the following example: > > > > ,---- > > | For this example, I will use this image [[myimage.png]] which > > is a very good one. > > `---- > > > > Then, when exported, it produces the following LaTeX code: > > > > ,---- > > | For this example, I will the use this image > > | \centerline{\includegraphics{myimage}} which is a very good one. > > `---- > > > > Which produces weird layout when compiled to PDF. > > > > In this case, we should just generate \includegraphics{myimage} > > without the > > centerline command. > > Agree. > > > > 2) Images in floats > > > > In the case of floats, the correct generated code should be > > something like: > > > > \begin{figure}[htb] > > \centering > > \includegraphics{myimage} > > \label{LABEL} > > \caption{CAPTION} > > \end{figure} > > > > and not > > > > \begin{figure}[htb] > > \centerline{\includegraphics{myimage}} > > \label{LABEL} > > \caption{CAPTION} > > \end{figure} > > > > This can also be fixed quickly I think. > > Yes sure, but what is wrong with \centerline? does the \centering > lead to a different result? > I've been running with the following patch for a little while and have seen no problems (it does \centering rather than \centerline but I don't think it makes a difference for an image - it would make a difference for a floating centered paragraph with multiple lines however.) There is another problem as well: there is a \n added after the \end{figure} which leads to spurious paragraphs. The patch fixes that too. diff --git a/lisp/org-latex.el b/lisp/org-latex.el index 4058891..248d653 100644 --- a/lisp/org-latex.el +++ b/lisp/org-latex.el @@ -1553,8 +1585,8 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER." (cond ((and imgp (plist-get org-export-latex-options-plist :inline-images)) (insert (concat - (if floatp "\\begin{figure}[htb]\n") - (format "\\centerline{\\includegraphics[%s]{%s}}\n" + (if floatp "\\begin{figure}[htb]\n\\centering\n") + (format "\\includegraphics[%s]{%s}\n" attr (if (file-name-absolute-p raw-path) (expand-file-name raw-path) @@ -1563,7 +1595,7 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER." (format "\\caption{%s%s}\n" (if label (concat "\\label{" label "}") "") (or caption ""))) - (if floatp "\\end{figure}\n")))) + (if floatp "\\end{figure}")))) (coderefp (insert (format (org-export-get-coderef-format path desc) But there is the additional question that's raised in the thread: Carsten Dominik <carsten.dominik@gmail.com> wrote: > > On Sep 23, 2009, at 11:09 PM, S=E9bastien Vauban wrote: > > > Jeff Kowalczyk wrote: > >> S=E9bastien Vauban <wxhgmqzgwmuf@...> writes: > >>> Francesco Pizzolante wrote: > >>>> In this case, we should just generate \includegraphics{myimage} =20 > >>>> without > >>>> the centerline command. > >>> > >>> Given the output of the `\centerline' command, I guess that the =20 > >>> inlining of > >>> an image inside a line of text is not supported as is by Org. I =20 > >>> can second > >>> such a choice. > >> > >> +1 for default to inline graphics. When using Org for How-To and =20 > >> project > >> documentation delivered as PDF, floating screenshot-size images =20 > >> typically > >> situate far from the descriptive text. > > > > My point was mainly that, IMHO, floating or not should not be tied =20 > > to the > > presence or absence of caption/label. > > > > Your problem with screenshots far away should be solved by putting =20 > > the H > > specifier to the float environment and loading the `float' package. > > > > > >> I would prefer inline images by default (or option), and a file/=20 > >> subtree > >> level option to use LaTeX floating layout. > > > > That'd be a great way to be able to specify which type of "inlining" =20= > > > we want. > > On a per file basis seems sufficient for me. > > Hi Sebastien, > > how about working out a detailed proposal how this should work? > > - Carsten > > Currently, specifying either a #+CAPTION or a #+LABEL (or both) floats the image. Absent both of these the image is inlined (although without the above patch, it's inlined badly). LaTeX implicitly assumes that a floating figure has a caption: that's where the figure number is incremented for example. Given that, it does not seem productive to have a separate indicator for floats. Of course, if one is willing to forego the incrementing of the counter, then a float without a caption is possible in LaTeX - but is it useful? If it is, then using the #+LABEL specifier alone is enough to float the image (but currently, there is a problem in org-latex in that a \caption is always output - but that is a minor problem, easily fixed, if so desired). To summarize: org-latex currently always produces a \caption which causes LaTeX to increment the figure counter, but also to produce a "Figure <N>:" caption, even if the caption is empty. We could change org-latex not to produce a \caption if #+CAPTION is absent, but that would mean that the figure counter does not get incremented. I'm not sure that a saparate specifier is needed (it might be desirable only on readability grounds: saying #+FLOAT, rather than #+CAPTION or #+LABEL makes it a bit more obvious). These specifiers are per-image, afaict, not per-file/subtree. For my part, I don't see the need for the coarser kind of control: per-image is enough. But if desired, then maybe #+FLOAT: t (default nil) or perhaps better #+OPTIONS: float:t can be used for the coarser control. I hope this is clear but if there are questions, let me know. What do you think? Thanks, Nick ^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: LaTeX export of images 2009-09-29 19:32 ` Nick Dokos @ 2009-09-30 7:30 ` Carsten Dominik [not found] ` <8809.1254252762-/Z0n3E7Cx4uRQBexplnFlPegYHeGw8Jk@public.gmane.org> 1 sibling, 0 replies; 16+ messages in thread From: Carsten Dominik @ 2009-09-30 7:30 UTC (permalink / raw) To: nicholas.dokos; +Cc: mailing-list-org-mode On Sep 29, 2009, at 9:32 PM, Nick Dokos wrote: > > > diff --git a/lisp/org-latex.el b/lisp/org-latex.el > index 4058891..248d653 100644 > --- a/lisp/org-latex.el > +++ b/lisp/org-latex.el > @@ -1553,8 +1585,8 @@ The conversion is made depending of STRING- > BEFORE and STRING-AFTER." > (cond ((and imgp (plist-get org-export-latex-options- > plist :inline-images)) > (insert > (concat > - (if floatp "\\begin{figure}[htb]\n") > - (format "\\centerline{\\includegraphics[%s]{%s}}\n" > + (if floatp "\\begin{figure}[htb]\n\\centering\n") > + (format "\\includegraphics[%s]{%s}\n" > attr > (if (file-name-absolute-p raw-path) > (expand-file-name raw-path) > @@ -1563,7 +1595,7 @@ The conversion is made depending of STRING- > BEFORE and STRING-AFTER." > (format "\\caption{%s%s}\n" > (if label (concat "\\label{" label "}") "") > (or caption ""))) > - (if floatp "\\end{figure}\n")))) > + (if floatp "\\end{figure}")))) > (coderefp > (insert (format > (org-export-get-coderef-format path desc) > I have applied this patch ^ permalink raw reply [flat|nested] 16+ messages in thread
[parent not found: <8809.1254252762-/Z0n3E7Cx4uRQBexplnFlPegYHeGw8Jk@public.gmane.org>]
* Re: LaTeX export of images [not found] ` <8809.1254252762-/Z0n3E7Cx4uRQBexplnFlPegYHeGw8Jk@public.gmane.org> @ 2009-09-30 8:53 ` Francesco Pizzolante 0 siblings, 0 replies; 16+ messages in thread From: Francesco Pizzolante @ 2009-09-30 8:53 UTC (permalink / raw) To: nicholas.dokos-VXdhtT5mjnY; +Cc: mailing-list-org-mode, Carsten Dominik Hi Nick and Carsten, First of all I thank you for your replies and the already checked-in patch. The behavior for images inserted in the middle of a paragraph is now correct. >> Yes sure, but what is wrong with \centerline? does the \centering >> lead to a different result? Using \centerline in the middle of a paragraph makes the image centered in the rest of the line: if you have word before and after the image, you get first the words before the image, then you get the image which is centered according to the remaining space on the line, and finally the words that come after the images are printed on the following line... it was really weird. Now, thanks to Nick's patch the image is correctly printed in the middle of the text. > Currently, specifying either a #+CAPTION or a #+LABEL (or both) floats > the image. Absent both of these the image is inlined (although without > the above patch, it's inlined badly). > > LaTeX implicitly assumes that a floating figure has a caption: that's > where the figure number is incremented for example. Given that, it does > not seem productive to have a separate indicator for floats. > > Of course, if one is willing to forego the incrementing of the counter, > then a float without a caption is possible in LaTeX - but is it useful? > If it is, then using the #+LABEL specifier alone is enough to float the > image (but currently, there is a problem in org-latex in that a \caption > is always output - but that is a minor problem, easily fixed, if so > desired). > > To summarize: org-latex currently always produces a \caption which > causes LaTeX to increment the figure counter, but also to produce > a "Figure <N>:" caption, even if the caption is empty. We could > change org-latex not to produce a \caption if #+CAPTION is absent, > but that would mean that the figure counter does not get incremented. > > I'm not sure that a saparate specifier is needed (it might be > desirable only on readability grounds: saying #+FLOAT, rather than > #+CAPTION or #+LABEL makes it a bit more obvious). These specifiers are > per-image, afaict, not per-file/subtree. For my part, I don't > see the need for the coarser kind of control: per-image is enough. > But if desired, then maybe > > #+FLOAT: t (default nil) > > or perhaps better > > #+OPTIONS: float:t > > can be used for the coarser control. > > I hope this is clear but if there are questions, let me know. What do > you think? This is perfectly clear. I thought a little bit more about this and I come with the following idea. We should float an image by default if the image is alone on a line (with or without caption or label). If label and caption are present than we add them to the float. If not, we simply float the image. An extra option like #+OPTIONS: float:nil/t could be used if we want to override the default behavior. In summary: 1) an image in the middle of the text simply exports as a \includegraphics command (this works perfectly no, so nothing to do here); 2) an image alone on a line should be floated by default; 3) caption and label are added only if present; 4) and extra option can be used to override the default behavior determining if the image is floated of not. Does all this make sense to you? Do you think this is feasible? If you have questions, please let me know. Regards, Francesco _______________________________________________ Emacs-orgmode mailing list Remember: use `Reply All' to send replies to the list. Emacs-orgmode-mXXj517/zsQ@public.gmane.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode ^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2009-10-20 10:18 UTC | newest] Thread overview: 16+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2009-09-22 13:39 LaTeX export of images Francesco Pizzolante [not found] ` <87pr9jf68i.fsf-djc/iPCCuDYQheJpep6IedvLeJWuRmrY@public.gmane.org> 2009-09-23 14:04 ` Sébastien Vauban 2009-09-23 15:30 ` Jeff Kowalczyk 2009-09-23 21:09 ` Sébastien Vauban 2009-09-29 9:30 ` Carsten Dominik 2009-10-02 6:55 ` Carsten Dominik 2009-10-02 13:04 ` Darlan Cavalcante Moreira 2009-10-02 15:23 ` Nick Dokos 2009-10-03 7:05 ` Carsten Dominik 2009-10-05 14:19 ` Darlan Cavalcante Moreira [not found] ` <B2499F80-4D9D-4F76-9432-ACF04E38C8EE-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2009-10-13 10:03 ` Francesco Pizzolante 2009-10-20 10:18 ` Carsten Dominik 2009-09-29 9:28 ` Carsten Dominik 2009-09-29 19:32 ` Nick Dokos 2009-09-30 7:30 ` Carsten Dominik [not found] ` <8809.1254252762-/Z0n3E7Cx4uRQBexplnFlPegYHeGw8Jk@public.gmane.org> 2009-09-30 8:53 ` Francesco Pizzolante
Code repositories for project(s) associated with this public inbox https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).