Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Citation in image caption, footnote CSL style & latex output: footnote text is missing #5476

Closed
njbart opened this issue Apr 23, 2019 · 4 comments
Milestone

Comments

@njbart
Copy link

njbart commented Apr 23, 2019

Based on the (closed) issues #1506, #4683, and #5367, I would have guessed that most, if not all issues connected with footnotes in image and table captions and latex output had been fixed.

However, when using a citation in an image caption with a footnote CSL style such as chicago-fullnote-bibliography.csl, and latex/pdf as a target format, I found that the footnote mark inside the caption is present in the output while the complete footnote text is missing.

I also found that normal footnotes inside image captions show the same effect.

When switching to html output, the footnote text is rendered as expected.

Surprisingly, both normal and citation footnotes are rendered as expected in latex/pdf if the link to an actual image file is omitted (see the example below).

(As a side note: A warning “replacing image with description” is generated if no actual image file is indicated, but the alt text is not rendered at all, though this might be a good idea ...)

Example (processed with the latest dev versions of pandoc & pandoc-citeproc):

pandoc --filter pandoc-citeproc -o test.pdf << EOT

# Example: Footnotes

Blah blah blah.

![Image, with link to image file, and footnote[^1]](https://upload.wikimedia.org/wikipedia/commons/thumb/d/d7/Leonhard_Euler.jpg/220px-Leonhard_Euler.jpg "DESCRIPTION OF FIRST IMAGE"){width=20mm}

Blah blah blah.

![Image, with alt text only, and footnote[^1]]("DESCRIPTION OF FIRST IMAGE"){width=20mm}

# Example: Citations

Blah blah blah.

![Image, with link to image file, and citation[@item1]](https://upload.wikimedia.org/wikipedia/commons/thumb/d/d7/Leonhard_Euler.jpg/220px-Leonhard_Euler.jpg "DESCRIPTION OF FIRST IMAGE"){width=20mm}

Blah blah blah.

![Image, with alt text only, and citation[@item1]]("DESCRIPTION OF FIRST IMAGE"){width=20mm}

[^1]: Image caption footnote.

---
csl: chicago-fullnote-bibliography.csl
reference-section-title: References
references:
- id: item1
  type: article-journal
  title: A paper
  author:
    - family: Doe
      given: John
  issued:
    - year: 2019
...
EOT

Actual output:

test

Expected:

footnote text for footnotes 1 and 3

Another puzzling detail is that the latex output from this example (replacing -o test.pdf by -t latex -o test.tex, output shown below) does not contain a single occurrence of \footnotetext, which makes it unclear where the correct text for footnotes 2 and 4 in the pdf above even comes from.

\hypertarget{example-footnotes}{%
\section{Example: Footnotes}\label{example-footnotes}}

Blah blah blah.

\begin{figure}
\centering
\includegraphics[width=20mm,height=\textheight]{https://upload.wikimedia.org/wikipedia/commons/thumb/d/d7/Leonhard_Euler.jpg/220px-Leonhard_Euler.jpg}
\caption[Image, with link to image file, and footnote]{Image, with link
to image file, and footnote\footnotemark{}}
\end{figure}

Blah blah blah.

\begin{figure}
\centering
\includegraphics[width=20mm,height=\textheight]{"DESCRIPTION OF FIRST IMAGE"}
\caption[Image, with alt text only, and footnote]{Image, with alt text
only, and footnote\footnotemark{}}
\end{figure}

\hypertarget{example-citations}{%
\section{Example: Citations}\label{example-citations}}

Blah blah blah.

\begin{figure}
\centering
\includegraphics[width=20mm,height=\textheight]{https://upload.wikimedia.org/wikipedia/commons/thumb/d/d7/Leonhard_Euler.jpg/220px-Leonhard_Euler.jpg}
\caption[Image, with link to image file, and citation]{Image, with link
to image file, and citation\footnotemark{}}
\end{figure}

Blah blah blah.

\begin{figure}
\centering
\includegraphics[width=20mm,height=\textheight]{"DESCRIPTION OF FIRST IMAGE"}
\caption[Image, with alt text only, and citation]{Image, with alt text
only, and citation\footnotemark{}}
\end{figure}

\hypertarget{bibliography}{%
\section*{References}\label{bibliography}}
\addcontentsline{toc}{section}{References}

\hypertarget{refs}{}
\leavevmode\hypertarget{ref-item1}{}%
Doe, John. ``A Paper,'' 2019.
@scottmartincampbell
Copy link

I think this example can be simplified quite a bit. The following does not work for me, using pandoc 2.7.2:

pandoc -o test.pdf << EOT
![A picture^[from https://en.wikipedia.org/wiki/Flower]](https://upload.wikimedia.org/wikipedia/commons/thumb/a/a5/Flower_poster_2.jpg/330px-Flower_poster_2.jpg)
EOT

That example is borrowed from #4683. There is a superscript in the caption, but no footnote text. I found the same problem with beamer. This had not been a problem until I upgraded to 2.7.2. I think I'd been using 2.5.

@jgm jgm transferred this issue from jgm/pandoc-citeproc May 1, 2019
@jgm
Copy link
Owner

jgm commented May 1, 2019

So it appears that this is really a pandoc issue, not pandoc-citeproc specific.
Apparently in fixing #4683 we fixed the case that didn't work before but broke the case that DID work before!

@jgm jgm added this to the 2.7.3 milestone May 1, 2019
@jgm
Copy link
Owner

jgm commented May 1, 2019

For

![The moon^[A note.]](test/lalune.jpg)

we get this latex

\begin{figure}
\centering
\includegraphics{test/lalune.jpg}
\caption[The moon]{The moon\footnotemark{}}
\end{figure}

As you can see, the footnotemark is there but not the footnote.

@jgm
Copy link
Owner

jgm commented May 2, 2019

Closed by a203230

@jgm jgm closed this as completed May 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants