emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bug and quick bugfix
@ 2019-10-08 22:19 Godefroy
  2019-10-13  7:26 ` Nicolas Goaziou
  0 siblings, 1 reply; 5+ messages in thread
From: Godefroy @ 2019-10-08 22:19 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

As it is my first email to the list, please forgive me if I do anything
the wrong way.

I recently encountered a bug when exporting an org file to LaTeX: when
generating a figure with a caption, the LaTeX result has the following
shape:

\begin{figure}
…
\caption{\label{…}
Content of the caption}
\end{figure}

When compiling to LaTeX, the carriage return causes a indesirable white
space in some cases. What I would expect is:

\begin{figure}
…
\caption{Content of the caption}
\label{…}
\end{figure}

To fix this, I have changed the org-latex--caption/label-string function
in ox-latex.el on lines 1314 and 1315:

(format (if nonfloat "\\captionof{%s}%s{%s%s}\n"
 "\\caption%s%s{%s%s}\n")

becomes

(format (if nonfloat "\\captionof{%s}%s{%s}\n%s"
 "\\caption%s%s{%s}\n%s")

I hope that this bug report and the quickfix I found will help you.

Sincerely,

Godefroy Vannoye

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Bug and quick bugfix
  2019-10-08 22:19 Bug and quick bugfix Godefroy
@ 2019-10-13  7:26 ` Nicolas Goaziou
  2019-10-13  7:31   ` Ken Mankoff
  2019-10-13 11:21   ` Vladimir Lomov
  0 siblings, 2 replies; 5+ messages in thread
From: Nicolas Goaziou @ 2019-10-13  7:26 UTC (permalink / raw)
  To: Godefroy; +Cc: emacs-orgmode

Hello,

Godefroy <godefroy.vannoye@gmail.com> writes:

> I recently encountered a bug when exporting an org file to LaTeX: when
> generating a figure with a caption, the LaTeX result has the following
> shape:
>
> \begin{figure}
> …
> \caption{\label{…}
> Content of the caption}
> \end{figure}
>
> When compiling to LaTeX, the carriage return causes a indesirable white
> space in some cases. What I would expect is:
>
> \begin{figure}
> …
> \caption{Content of the caption}
> \label{…}
> \end{figure}
>
> To fix this, I have changed the org-latex--caption/label-string function
> in ox-latex.el on lines 1314 and 1315:
>
> (format (if nonfloat "\\captionof{%s}%s{%s%s}\n"
>  "\\caption%s%s{%s%s}\n")
>
> becomes
>
> (format (if nonfloat "\\captionof{%s}%s{%s}\n%s"
>  "\\caption%s%s{%s}\n%s")

IIRC, the label has to be included in the caption command. I applied
a different solution. Let me know if that works for you.

Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Bug and quick bugfix
  2019-10-13  7:26 ` Nicolas Goaziou
@ 2019-10-13  7:31   ` Ken Mankoff
  2019-10-13 11:21   ` Vladimir Lomov
  1 sibling, 0 replies; 5+ messages in thread
From: Ken Mankoff @ 2019-10-13  7:31 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Godefroy, emacs-orgmode


On 2019-10-13 at 09:26 +02, Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote...
> IIRC, the label has to be included in the caption command. I applied a
> different solution. Let me know if that works for you.

I thought so too. But I couldn't find a definitive answer for this when searching about this last night.

  -k.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Bug and quick bugfix
  2019-10-13  7:26 ` Nicolas Goaziou
  2019-10-13  7:31   ` Ken Mankoff
@ 2019-10-13 11:21   ` Vladimir Lomov
  2019-10-15  9:09     ` Godefroy
  1 sibling, 1 reply; 5+ messages in thread
From: Vladimir Lomov @ 2019-10-13 11:21 UTC (permalink / raw)
  To: Godefroy, emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1455 bytes --]

Hello,
** Nicolas Goaziou <mail@nicolasgoaziou.fr> [2019-10-13 09:26:42 +0200]:

> Hello,
> 
> Godefroy <godefroy.vannoye@gmail.com> writes:
> 
>> I recently encountered a bug when exporting an org file to LaTeX: when
>> generating a figure with a caption, the LaTeX result has the following
>> shape:
>>
>> \begin{figure}
>> …
>> \caption{\label{…}
>> Content of the caption}
>> \end{figure}
>>
>> When compiling to LaTeX, the carriage return causes a indesirable white
>> space in some cases. What I would expect is:
>>
>> \begin{figure}
>> …
>> \caption{Content of the caption}
>> \label{…}
>> \end{figure}
>>
>> To fix this, I have changed the org-latex--caption/label-string function
>> in ox-latex.el on lines 1314 and 1315:
>>
>> (format (if nonfloat "\\captionof{%s}%s{%s%s}\n"
>>  "\\caption%s%s{%s%s}\n")
>>
>> becomes
>>
>> (format (if nonfloat "\\captionof{%s}%s{%s}\n%s"
>>  "\\caption%s%s{%s}\n%s")
> 
> IIRC, the label has to be included in the caption command. I applied
> a different solution. Let me know if that works for you.

There is no strict rule but a general good practice: for caption
material put label command inside the caption macro. Otherwise there
might be some side effects.

> Regards,
> 
> -- 
> Nicolas Goaziou

---
WBR, Vladimir Lomov

-- 
QOTD:
	"I thought I saw a unicorn on the way over, but it was just a
	horse with one of the horns broken off."

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Bug and quick bugfix
  2019-10-13 11:21   ` Vladimir Lomov
@ 2019-10-15  9:09     ` Godefroy
  0 siblings, 0 replies; 5+ messages in thread
From: Godefroy @ 2019-10-15  9:09 UTC (permalink / raw)
  To: Vladimir Lomov, emacs-orgmode

Thanks for your replies. Your solution works for me, thank you a lot for
your work.

Sincerely,

Godefroy Vannoye

On 10/13/19 1:21 PM, Vladimir Lomov wrote:
> Hello,
> ** Nicolas Goaziou <mail@nicolasgoaziou.fr> [2019-10-13 09:26:42 +0200]:
>
>> Hello,
>>
>> Godefroy <godefroy.vannoye@gmail.com> writes:
>>
>>> I recently encountered a bug when exporting an org file to LaTeX: when
>>> generating a figure with a caption, the LaTeX result has the following
>>> shape:
>>>
>>> \begin{figure}
>>> …
>>> \caption{\label{…}
>>> Content of the caption}
>>> \end{figure}
>>>
>>> When compiling to LaTeX, the carriage return causes a indesirable white
>>> space in some cases. What I would expect is:
>>>
>>> \begin{figure}
>>> …
>>> \caption{Content of the caption}
>>> \label{…}
>>> \end{figure}
>>>
>>> To fix this, I have changed the org-latex--caption/label-string function
>>> in ox-latex.el on lines 1314 and 1315:
>>>
>>> (format (if nonfloat "\\captionof{%s}%s{%s%s}\n"
>>>  "\\caption%s%s{%s%s}\n")
>>>
>>> becomes
>>>
>>> (format (if nonfloat "\\captionof{%s}%s{%s}\n%s"
>>>  "\\caption%s%s{%s}\n%s")
>> IIRC, the label has to be included in the caption command. I applied
>> a different solution. Let me know if that works for you.
> There is no strict rule but a general good practice: for caption
> material put label command inside the caption macro. Otherwise there
> might be some side effects.
>
>> Regards,
>>
>> -- 
>> Nicolas Goaziou
> ---
> WBR, Vladimir Lomov
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-10-15  9:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-08 22:19 Bug and quick bugfix Godefroy
2019-10-13  7:26 ` Nicolas Goaziou
2019-10-13  7:31   ` Ken Mankoff
2019-10-13 11:21   ` Vladimir Lomov
2019-10-15  9:09     ` Godefroy

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).