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

[Bug]: write_latex pattern outputs 3 back ticks + latex at the beginning and 3 back ticks at the ending of document #1107

Open
1 task done
questr-hub opened this issue Nov 3, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@questr-hub
Copy link

questr-hub commented Nov 3, 2024

What happened?

I ran the the following command with the intention of using Fabric to write_latex from a Markdown document and then pipe that into the to_pdf command to generate a PDF.

cat article.md | fabric --pattern write_latex | to_pdf

Unfortunately, the LaTeX file that it creates has leading and trailing characters that the LaTeX engine called by to_pdf chokes on:

First line of document: ```latex
Last line of document: ```

Version check

  • Yes I was.

Relevant log output

$ cat article.tex | to_pdf
Error running pdflatex: exit status 1
pdflatex output:
This is pdfTeX, Version 3.141592653-2.6-1.40.24 (TeX Live 2022/Debian) (preloaded format=pdflatex)
 restricted \write18 enabled.
entering extended mode
(/tmp/latex_1317854834/input.tex
LaTeX2e <2022-11-01> patch level 1
L3 programming layer <2023-01-16>

! LaTeX Error: Missing \begin{document}.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.1 `
     ``latex
Missing character: There is no ` in font nullfont!
Missing character: There is no ` in font nullfont!
Missing character: There is no ` in font nullfont!
Missing character: There is no l in font nullfont!
Missing character: There is no a in font nullfont!
Missing character: There is no t in font nullfont!
Missing character: There is no e in font nullfont!
Missing character: There is no x in font nullfont!

Relevant screenshots (optional)

Screenshot 2024-11-03 1 44 31 PM

@questr-hub questr-hub added the bug Something isn't working label Nov 3, 2024
@questr-hub questr-hub changed the title [Bug]: write_latex pattern outputs "latex" and "" at the beginning and ending of document [Bug]: write_latex pattern outputs latex and at the beginning and ending of document Nov 3, 2024
@questr-hub questr-hub changed the title [Bug]: write_latex pattern outputs latex and at the beginning and ending of document [Bug]: write_latex pattern outputs 3 back ticks + latex at the beginning and 3 back ticks at the ending of document Nov 3, 2024
@questr-hub
Copy link
Author

I can address the issue by adding a sed command as follows but I'm curious why Fabric's pattern for write_latex is adding the extra lines, particularly since it instructs the API as folo

Clean with sed
cat article.md | fabric --pattern write_latex | sed '1d;$d' > article.tex

From system.md for write_latex pattern:

  • Do not output anything besides the valid LaTeX code. Any additional thoughts or comments should be placed within \iffalse ... \fi sections.

And, I added the following as well:

  • Do not output ```latex at the beginning of the file or ``` at the end of the file.

@arminzaugg
Copy link

Hi @questr-hub
I can confirm I have the same issue. Thank you for the workaround tip.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants