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

line blocks results in uneven indents in LaTeX output #9088

Closed
priiduonu opened this issue Sep 18, 2023 · 5 comments
Closed

line blocks results in uneven indents in LaTeX output #9088

priiduonu opened this issue Sep 18, 2023 · 5 comments
Labels

Comments

@priiduonu
Copy link
Contributor

When converting from markdown to LaTeX the following snippet:

---
header-includes:
    - \usepackage{tgtermes}
---

this is the line block:

|    0 - A
|    1 - B
|    2 - C
|    3 - D

it produces the following output:

this is the line block:

~~~0 - A\\
\hspace*{0.333em}\hspace*{0.333em}\hspace*{0.333em}1 - B\\
\hspace*{0.333em}\hspace*{0.333em}\hspace*{0.333em}2 - C\\
\hspace*{0.333em}\hspace*{0.333em}\hspace*{0.333em}3 - D

When converting the output to PDF, it seems that with certain fonts the first row of the line block becomes less indented than the rest of the lines, caused by the ~ instead of \hspace. When I manually replace all ~ with \hspace*{0.333em}, all lines in the block are indented as expected.

pandoc 3.1.6.2

@priiduonu priiduonu added the bug label Sep 18, 2023
@jgm
Copy link
Owner

jgm commented Sep 18, 2023

Background (from code comments on inlineListToLaTeX):

    -- nonbreaking spaces (~) in LaTeX don't work after line breaks,
    -- so we turn nbsps after hard breaks to \hspace commands.
    -- this is mostly used in verse.

@jgm
Copy link
Owner

jgm commented Sep 18, 2023

Interestingly, they line up with the default font, but not with pgtermes.

@jgm
Copy link
Owner

jgm commented Sep 18, 2023

Note that the \hspace approach loses "nonbreakingness," as well as the flexible resizability of a ~.

@priiduonu
Copy link
Contributor Author

Correct. I've tried several non-default fonts, with the same result.

@jgm
Copy link
Owner

jgm commented Sep 18, 2023

I think using

\strut ~~~

is a better approach.

@jgm jgm closed this as completed in e57953b Sep 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants