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

[LaTeX] Pass nameinlink to cleveref when appropriate #203

Open
themightyoarfish opened this issue Oct 8, 2018 · 4 comments
Open

[LaTeX] Pass nameinlink to cleveref when appropriate #203

themightyoarfish opened this issue Oct 8, 2018 · 4 comments
Milestone

Comments

@themightyoarfish
Copy link

themightyoarfish commented Oct 8, 2018

In my metadata block I use

…
cref: True
nameInLink: True
…

Nonetheless, I get and undefined command error for \cref when converting to Latex pdf unless I specifically include \usepackage{cleveref} in my template.tex.

Likewise, I need to pass the nameinlink option in the template, it doesn't work when put into the metadata block.

What could the problem be?

@lierdakil
Copy link
Owner

cref: True specifically converts pandoc-crossref references to \cref LaTeX command when outputting to LaTeX (or PDF via LaTeX). It also tries to add relevant stuff into document preamble, but that won't really work if you're using a custom template (mostly for obvious reasons). If you want to allow pandoc-crossref to include TeX code it thinks it needs to into your template, you need to have something like this in your preamble:

$for(header-includes)$
$header-includes$
$endfor$

nameInLink doesn't apply to LaTeX output. nameInLink changes the behaviour of linkReferences option, which is documented thusly:

This has no effect on LaTeX output, since in this case, hyperlinking references is handled with hyperref LaTeX package.

So you might just as well use your custom template anyway and include \usepackage[nameinlink]{cleveref} manually.

All that said, I agree that nameInLink pandoc-crossref option could be repurposed to pass nameinlink to cleveref. So I'll treat this as an enhancement request. Will try to implement when I have some free time (which I seem to be rather short on lately)

@themightyoarfish
Copy link
Author

I see. Not so familiar with Pandoc, thanks for the explanation.
I think passing nameinlink to cleverf would be a reasonable and straightforward effect of setting this pandoc option.

@zwz
Copy link

zwz commented Nov 20, 2018

@lierdakil
I was using a custom template with cref. I removed

$for(header-includes)$
$header-includes$
$endfor$

I used --listings option for pandoc.
But there came an complain:
LaTeX Error: Environment codelisting undefined.

So do I have to copy the codelisting definition generated by 'header-includes' to my custom template?

@lierdakil
Copy link
Owner

@zwz. Please do not hijack issues, I have a hard enough time tracking those as it is. Create a new one if you have a question that's not immediately relevant to any open issues. That said, I've already explained this in #197

@lierdakil lierdakil added this to the v0.4 milestone Mar 3, 2019
@lierdakil lierdakil changed the title cref: True doesn't seem to do anything [LaTeX] Pass nameinlink to cleveref when appropriate Mar 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants