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

Error Undefined control sequence when converting markdown to PDF #10277

Closed
yilas opened this issue Oct 9, 2024 · 1 comment
Closed

Error Undefined control sequence when converting markdown to PDF #10277

yilas opened this issue Oct 9, 2024 · 1 comment
Labels

Comments

@yilas
Copy link

yilas commented Oct 9, 2024

Hello 👋🏻

ℹ️ I have just opened an issue to mermaid-filter (issue 134) but it might actually be a pandoc issue rather than a mermaid-filter one. Just in case, I'm posting the same issue here as well.

The issue

When trying to convert a markdown file with Mermaid content to PDF using the mermaid-filter project, I encountered the following error :

Error producing PDF.
! Undefined control sequence.
<argument> „den éischte Kontakt'' (\(\color 
                                               {red}{\textsf {formell}}\))
l.64 ...uxe9ischte-kontakt-colorredtextsfformell}}

It seems that the problem is related to the following part of the markdown file :

($\color{red}{\textsf{formell}}$)

When I remove that section, the PDF is generated correctly.

Example of problematic file

Here is the markdown file that produces the error (test.md) :

# Dialog

## „den éischte Kontakt” ($\color{red}{\textsf{formell}}$)

And here is a modified version that works (test_ok.md) :

# Dialog

## „den éischte Kontakt”

Step to reproduce

  1. Create a markdown file (test.md)

  2. Run the following command

    pandoc -F mermaid-filter -o output.pdf test.md
  3. Observe the error

    Error producing PDF.
    ! Undefined control sequence.
    <argument> „den éischte Kontakt'' (\(\color 
                                                   {red}{\textsf {formell}}\))
    l.64 ...uxe9ischte-kontakt-colorredtextsfformell}}

Environnement

  • Operating system
cat /etc/os-release 
NAME="Ubuntu"
VERSION="20.04.6 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.6 LTS"
  • Pandoc version
$ pandoc --version
pandoc 2.5
Compiled with pandoc-types 1.17.5.4, texmath 0.11.2.2, skylighting 0.7.7
Default user data directory: /home/codespace/.pandoc
Copyright (C) 2006-2018 John MacFarlane
Web:  http://pandoc.org
This is free software; see the source for copying conditions.
There is no warranty, not even for merchantability or fitness
for a particular purpose.
  • mermaid-filter version
$ npm view mermaid-filter version
1.4.7

Expected behavior

The file should be converted to PDF without errors.

@yilas yilas added the bug label Oct 9, 2024
@bpj
Copy link

bpj commented Oct 9, 2024

You need to have the math inside the argument to the \color command, not the other way around. Note that the $math$ syntax can't be used for arbitrary raw LaTeX commands; I suspect you want the raw markup syntax: see my answer to #10278.

@jgm jgm closed this as completed Oct 9, 2024
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

3 participants