I am trying to configure latexmk in TeXworks 0.4.5 accompanied by TeX Live 2013.

I followed the instructions on the TeXworks site, as noted in the picture below:

**TeXworks latexmk configuration

My code is very simple as follows:


This is my first latex test.
how are you.
This is a new line.
This is another line.

But I cannot compile it. The error message is:

Latexmk: Stopping because executing following code from command line
    $pdflatex=q/pdflatex -synctex=1 %O %S
gave an error:
    Can't find string terminator "/" anywhere before EOF at (eval 8) line 1.

C:\texlive\2013\bin\win32\runscript.tlu:650: command failed with exit code 2:
perl.exe c:/texlive/2013/texmf-dist/scripts/latexmk/latexmk.pl -e "$pdflatex=q/pdflatex -synctex=1 %O %S" -pdf test.tex

I also followed the steps in configure latexmk in Texworks 0.2.3. However it also failed in the end.

After that, I switched to TeXstudio which is configured beforehand:

latexmk -pdf -silent -pdflatex="pdflatex -synctex=1 %%O %%S" %

Although this works in TeXstudio, it does not compile my code in real-time mode, which behaves as the normal pdfLaTeX command.

  1. What reference should I refer to for latexmk?
  2. Is latexmk not compatible with TeXworks (TeX Live 2013)?
  • In the link you give, there is an additional / in one of the lines: $pdflatex=q/pdflatex $synctexoption %O %S/. Can you try adding that? (Error seems to be about / chars, so looks like a place to start.) – Joseph Wright May 27 '14 at 12:16
  • @JosephWright No error comes out! But it still does not compile as expected. I hope latexmk auto-compiles my tex file while I am editing such as adding a new word. But with the configuration above, I still need to manually compile the code for real effect. – Zachary May 27 '14 at 12:41
  • It sounds like you want latexmk to 'follow' file changes. TeXworks (and indeed most GUIs) aren't well set up for that as it expects the typesetting process to exit before displaying the PDF, which never happens in a 'follow' situation. I think in the past the suggestion to do this has been to use a separate viewer such as Sumatra and have latexmk running from e.g. the command line. – Joseph Wright May 27 '14 at 12:54
  • See for example tex.stackexchange.com/questions/96173/… and daleif's comment on his own answer – Joseph Wright May 27 '14 at 12:57
  • @JosephWright texworks's feature "typesetting process to exit before displaying the PDF" does not prevent a "follow" situation, I think. TeXworks starts two instances, one for editing, another for preview. – Zachary May 27 '14 at 13:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.