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
Latex writer eats usepackage in header-includes #5673
Comments
For this use-case, you can use https://pandoc.org/MANUAL.html#generic-raw-attribute
|
We might want to explore making this a little smoother, by treating usepackage (and other includes) as raw latex blocks when the |
That would be nice, yes. The experience is pretty rough right now. Just when you think you've got it figured out how to pass TeX code into the preamble, it doesn't work for one line of code when it worked for another. The process is quite confusing actually, even having read the docs. Also there are a lot of places online that have this technique documented. What they don't explain is that ⓐ this only worked before a certain version and ⓑ still works now but only for specific packages. |
@alerque if you use header-includes and the raw attribute syntax all the time everything should Just Work. There is however a detail which isn't mentioned in the manual and which apparently trips many people: the backtick is a reserved, though currently unused, character in YAML so you have to put everything which uses them in a YAML block scalar or (single) quoted string: header-includes:
- |
````{=latex}
\usepackage{thispackage}
````
- '`\usepackage{thatpackage}`{=latex}' The new YAML parser throws an error on unquoted backticks, but I suspect that people don't understand the error and/or don't know the fix and so wrongly conclude that raw attribute syntax doesn't work in metadata. I think I'll do a pull request adding a description of the problem with backticks in YAML to the manual. |
@bpj Thanks for the feedback. I think maybe your example has one too many backticks in the first (blockwise) usage, no? |
@alerque No there aren't too many backticks. Three is the minimum, but no
maximum is mentioned anywhere that I'm aware of. When using Vim I often do
`` 60I`<esc> `` to get a fence which goes across the window, as I think
that looks better.
Den ons 28 aug. 2019 11:20Caleb Maclennan <notifications@github.com> skrev:
… @bpj <https://github.com/bpj> Thanks for the feedback. I think maybe your
example has one too many backticks in the first (blockwise) usage, no?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#5673?email_source=notifications&email_token=AAI3OUZNZS53KUBZZWHDXBLQGY7KZA5CNFSM4IJHVXF2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5KOWNQ#issuecomment-525658934>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAI3OU74Y6GYDXQDPD2YFOLQGY7KZANCNFSM4IJHVXFQ>
.
|
I'm trying to convert a markdown document to PDF using LaTeX, and need some special things setup on the LaTeX side of things. I can use header-includes to pass through some commands just fine, but I need to load a package and pandoc is parsing an eating all attempts to use
\usepackage{}
.The output will have the length definition but the usepackage command will be stripped out.
I see in the changelog that in Pandoc 1.9:
This is probably a side affect of this, but it seems like it's being too greedy. I just need to pass the code on to LaTeX, I don't need pandoc to interpret whether it's valid or not.
The text was updated successfully, but these errors were encountered: