0

Hey it's me again and I am back with something that doesn't let me sleep anymore.

I am using the popular Eisvogel Pandoc template for rendering my markdown files to PDFs. So far everything is working splendid, but I just noticed that blockquotes are not aligned with the rest of the document. I inspected the eisvogel.latex file but I couldn't figure what the issue is.. It is driving me crazy. For some reason these blocks are a few points too wide... See images below, but beware this is triggering.

enter image description here

Zoomed, so it's clearly visible that the code blocks are a few points wider than the rest of the content (left and right are affected).

Left:

enter image description here

Right:

enter image description here

I seek your assistance! I should be able sleep again. :(

5
  • 2
    Tell us what options and code you're using. The eisvogel readme suggests using the --listings option, but I doubt that you are. But you are clearly using some option relevant to code blocks you haven't told us about, because that's not the default pandoc code block style either. Are you using a different --highlight-style? It's hard to say without that info, but my guess is that this is from the snugshade environment pandoc usually uses for code blocks, which adds padding of the length fboxsep. Try \setlength{\fboxsep}{0pt}.
    – frabjous
    May 9, 2022 at 1:12
  • You are right, I am using options. The highlight-style I am using is just kate, with adjusted colours. I'm using these options: pandoc mynotes.md \ -o out/myfile.pdf \ --from markdown+yaml_metadata_block+raw_html \ --template eisvogel \ --table-of-contents \ --toc-depth 6 \ --number-sections \ --top-level-division=chapter \ --highlight-style my.theme \ -H ./LaTeX/headers.tex, I highly doubt these are causing this issue. Your suggested addition helped, the box is trimmed, but the text is cut out now, since it didn't keep the padding. :(
    – mnqn
    May 9, 2022 at 15:06
  • 1
    Not sure what you mean by "trimmed"; the text should go all the way to the edge of the box and stop there, which admittedly, is a little unsightly. I guess you want to keep the padding, but have the padding inside the usual typeset area?
    – frabjous
    May 9, 2022 at 15:18
  • Exactly what you described is what is happening and exactly what you guess is my desire.
    – mnqn
    May 9, 2022 at 15:21
  • I actually get an error with those settings complaining that \frontmatter is not defined, but it works if I take out --top-level-division=chapter. I'm going to assume this is unrelated to this issue, and see what I can come up with.
    – frabjous
    May 9, 2022 at 15:36

1 Answer 1

3

When using the default Haskell skylighting library for code highlighting, pandoc typesets code listings in an environment called "Shaded" which it defines as the snugshade environment from the framed package.

That environment is defined so that the start of the text is in its usual spot, but there is padding for the shaded area so that it extends outside the usual typeset area.

However, that package also provides a starred version that keeps the padding for the shaded area in the inside of the usual typeset area rather than the outside, so the actual text inside is slightly indented on both sides.

So one thing you could do is redefine pandoc's Shaded environment to use that instead:

\renewenvironment{Shaded}{\begin{snugshade*}}{\end{snugshade*}}

You could put that either in your markdown document, in a yaml header-includes: option, or probably most appropriately, at the end of the ./LaTeX/headers.tex file you're including in the preamble with pandoc's -H option.

Since I don't have your my.theme highlight style, and the kate theme it's based on uses a white background, I couldn't test with that, but here's the result using the breezedark theme:

codeblock with snugshade*

1
  • This worked perfectly. Thank you so much, also for elaborating, this helps me a lot!
    – mnqn
    May 9, 2022 at 16:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .