0

Following the recommendation of the kind user in this post: PDFLaTeX and Arabic, Farsi and other scripts

I switched compilers, from Pdftex to Luatex in order to be able to print non-Latin alphabets, which works.

What doesn't work is my shell script to automatically convert from markdown, via pandoc, to a .tex file, to a PDF via Latexmk. I had this working perfectly, but I don't know how to do it for Luatex.

This was the script:

mkdir -p /home/Docs/Notes/{{title}} 
pandoc -r markdown-auto_identifiers -w latex {{file_path:absolute}} -o /home/Docs/Notes/{{title}}/{{title}}.tex --template="/home/Docs/LaTeX/My Templates/Notes/Notes.tex" --lua-filter=/home/Docs/LaTeX/Filters/highlight.lua --lua-filter=/home/Docs/LaTeX/Filters/highlight-period.lua --lua-filter=/home/Docs/LaTeX/Filters/Span.lua --lua-filter=/home/Docs/LaTeX/Filters/Span-period.lua
gnome-terminal -- bash -c "cd /home/Docs/Notes/{{title}} && latexmk -pvc -pdf < /dev/null && latexmk -c && cp {{title}}.pdf /home/Docs/Notes/ && exit; exec bash"

I run this from a plugin in Obsidian.md (a markdown editor) that can replace the {{title}} variables with the current note, i.e. file, name.

With the above script, I get told:

! Package babel Error: The bidi method 'basic' is available only in
(babel)                luatex. I'll continue with 'bidi=default', so
(babel)                expect wrong results.

I believe only the part after gnome-terminal is relevant, and I tried switching the latexmk command to this: latexmk -pdflatex=lualatex -pdf {{title}}.tex

With this it compiles a little further, but still get an error, and no PDF is produced.

=== TeX engine is 'pdfTeX'
Latexmk: Found input bbl file '2023-07-24.bbl'
Latexmk: Log file says output to '2023-07-24.pdf'
Biber warning: [177] Biber.pm:130> WARN - The file '2023-07-24.bcf' does not contain any citations!
Latexmk: Found biber source file(s) [2023-07-24.bcf]
Latexmk: All targets (2023-07-24.pdf) are up-to-date
Rc files read:
  /etc/LatexMk
Latexmk: This is Latexmk, John Collins, 20 November 2021, version: 4.76.
cp: cannot create regular file '/home/Docs/Notes/': Not a directory

My MWE LaTeX Document from the other thread:

\documentclass[a4paper, 12pt, oneside]{article}

\usepackage[bidi=basic]{babel}

\babelprovide[main, import]{english}
\babelprovide[onchar = ids fonts]{arabic}
\babelfont[arabic]{rm}[Renderer = HarfBuzz, Scale = MatchLowercase]{Amiri} 

\begin{document}
    Giaurs - From Persian فروشگاه‎ (gâvor)
\end{document}

How can I adapt this script to automate the process once again.

Thanks!

4
  • 1
    change -pdf to -pdflua see latexmk --help Commented Aug 23, 2023 at 14:18
  • 1
    @DavidCarlisle or just -lualatex
    – daleif
    Commented Aug 23, 2023 at 14:27
  • 2
    @daleif you say "just", I say it means the same and is 2 characters longer:-) Commented Aug 23, 2023 at 14:28
  • 1
    @DavidCarlisle easier to understand for the user ;-)
    – daleif
    Commented Aug 23, 2023 at 14:31

1 Answer 1

2

latexmk will use pdflatex by default (or explicitly via the -pdf option on the commandline). You can replace that by -pdflua or equivalently -lualatex

8
  • Now it seemingly mostly works, as in it's opening a compiled PDF in chromium which is weird because that's not my default PDF viewer at all. Also it's still not copying the new PDF to the desired directory, telling me Latexmk: This is Latexmk, John Collins, 20 November 2021, version: 4.76. cp: cannot create regular file '/home/Docs/Notes/': Not a directory which is strange since it is a directory. Commented Aug 23, 2023 at 15:04
  • In the output listings, latexmk says it had success. The error message appears to be from the command cp {{title}}.pdf /home/Docs/Notes/ (with presumably a correct substitution for {{title}}). Do you get the same error if you run the commands from the command line instead of a script? What are the contents of /home/Docs/Notes/? Commented Aug 23, 2023 at 23:33
  • has title got a space in its name? Commented Aug 23, 2023 at 23:56
  • sometimes, not always. The one I just tested did not. Commented Aug 24, 2023 at 11:41
  • @ReaderGuy42 your cp will fail if cp {{title}}.pdf /home/Docs/Notes/ expands to cp foo bar.pdf /home/Docs/Notes/ it needs quotes around the file name Commented Aug 24, 2023 at 11:45

You must log in to answer this question.

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