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

list of listings #1728

Closed
Bengt opened this issue Oct 29, 2014 · 5 comments
Closed

list of listings #1728

Bengt opened this issue Oct 29, 2014 · 5 comments

Comments

@Bengt
Copy link

Bengt commented Oct 29, 2014

I just missed to option to add a list of listing to the LaTeX/PDF document. While pandoc supports passing variables to activate the list of figures and the list of tables (see #1407), there is no equivalent for the list of listings (expected: pandoc --variable lol). Since Pandoc's LaTeX writer already knows about lstlistings --listings, it would be nice to have a command line option that triggers a list of listing in the corresponding template. I think it would be fine, to have the lol following the toc/lot/lof, but I guess there is no guideline to be found which supports that.

As a workaround, one can put the list before any other content:

\lstlistoflistings

# Introduction
@matthiasbeyer
Copy link

@Bengt How did you get list of listings in your output? I have \lstlistoflistings in my template source, though it doesn't list my listings.

Do I have to use some special markup for this? Also: How to include captions for my source code listings? I cannot find documentation about this!

@Bengt
Copy link
Author

Bengt commented Nov 23, 2015

@matthiasbeyer I tried modifying the template as you did and it worked, but ultimately I used the workaround I posted. I preferred not to change the template, because I wanted to be able to update the it to upstream changes without needing port my changes to newer versions.

Make sure to properly specify your template. If the problem persists, please file an issue for it.

I believe captions of source code listing are not supported by pandoc at the moment and a workaround is to use literal latex listings. - But please double check that. If you think the documentation should be improved, please file an issue describing the imperfection.

@matthiasbeyer
Copy link

@Bengt My list of listings is not generated at all.

What is the markup you use for captions? I assume my listings do not show up in the LOL because they have no captions.

@matthiasbeyer
Copy link

The trick was to do like someone said in #673:

~~~{#mypython .python .numberLines caption="Foo"}

@jgm
Copy link
Owner

jgm commented Mar 15, 2017

I think including raw tex via something like --include-before-body=FILENAME is the way to go here; it doesn't require changes to a template and it gets you what you need.

@jgm jgm closed this as completed Mar 15, 2017
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

5 participants