Skip to content

Raw TeX extension swallows spaces #2687

Closed
baskerville opened this Issue · 8 comments

2 participants

@baskerville

If test.md contains:

From \TeX to \LaTeX.

then pandoc -t json test.md yields:

[
  {
    "unMeta": {}
  },
  [
    {
      "t": "Para",
      "c": [
        {
          "t": "Str",
          "c": "From"
        },
        {
          "t": "Space",
          "c": []
        },
        {
          "t": "RawInline",
          "c": [
            "tex",
            "\\TeX "
          ]
        },
        {
          "t": "Str",
          "c": "to"
        },
        {
          "t": "Space",
          "c": []
        },
        {
          "t": "RawInline",
          "c": [
            "tex",
            "\\LaTeX"
          ]
        },
        {
          "t": "Str",
          "c": "."
        }
      ]
    }
  ]
]

You'll notice that the space after \TeX is not being rendered as {"t":"Space","c":[]}.

@jgm
Owner
@baskerville

Thanks, but none of the suggested fixes work: \TeX\ has the same output as \TeX, and \TeX{} yields {"t":"RawInline","c":["tex","\\TeX"]},{"t":"Str","c":"{}"},{"t":"Space","c":[]}.

@jgm
Owner
@baskerville

Thanks, \TeX\ is almost a solution, except that \ generates a non-breaking space, not a regular space.

@jgm
Owner
@baskerville

Yes it does.

It has a slight effect on readability though.

@jgm
Owner
@jgm jgm added a commit that closed this issue
@jgm LaTeX reader: `inlineCommand` now gobbles an empty `{}` after any com…
…mand.

This gives better results when people write e.g. `\TeX{}` in Markdown.

    \TeX{} and \LaTeX{}

now works as expected with `pandoc -f markdown -t latex`.

Closes #2687.
1874558
@jgm jgm closed this in 1874558
@baskerville

Great!

@c-forster c-forster pushed a commit to c-forster/pandoc that referenced this issue
@jgm LaTeX reader: `inlineCommand` now gobbles an empty `{}` after any com…
…mand.

This gives better results when people write e.g. `\TeX{}` in Markdown.

    \TeX{} and \LaTeX{}

now works as expected with `pandoc -f markdown -t latex`.

Closes #2687.
3cc3abf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.