Closed irmingard closed 6 years ago
I haven't had a chance to check this but it would seem you should be able to use the LaTeX workaround here:
label(path = "figure/test-figure.jpg",
caption = "Caption text including citation \\protect\\cite{Source2016}",
label = "test-figure",
type = "figure")
The label
function just copies the appropriate LaTeX code and doesn't do another conversion of any Markdown text like [@Source2016]
. You might need to compile your TeX document a second time since you are bypassing Pandoc's control of the bibliography here. Hope that works for you!
The caption then becomes "Caption text including citation [?]". Any other suggestions?
Did you compile the TeX file again?
So do I manually compile it and then press knit again? Doesn't that overwrite the manually compiled version? If I compile it manually, how will I get the PDF then without pressing knit again? Sorry for the confusion, I'm new to all of this.
It appears my suggestion won't work either. I am working on a solution but it may take me a couple weeks. With pandoc taking over the bibiliography there are lots of issues that are difficult to overwrite at times. It appears this functionality is not currently directly supported in pandoc, unfortunately.
Are there any updates to this issue? As a workaround, I'm citing sources in captions using plain text right now, however that leads to the problem that the source may not get added to the references if I don't cite it anywhere using the @ notation.
I recommend checking out the updated thesisdown
package which has a lot more feature built-in than this package, which was the precursor. thesisdown
is built on bookdown
so a lot of the pandoc issues are taken care of there. Here is the repo: http://github.com/ismayc/thesisdown.
@irmingard This might be of use to you: https://github.com/ismayc/thesisdown/issues/27
Thank you, it actually worked right away for me when I switched to thesisdown. :)
I want to include a figure where the caption contains a citation like
[@Source2016]
.Just adding
[@Source2016]
within the caption string breaks the PDF because subsequent code is printed to the PDF as text (e.g.\begin{figure}[htbp]
).I've also tried escaping the brackets with
\[@Source2016\]
, however that leads to the error message:'\[' is an unrecognized escape in character string
My R chunk: