I am not sure if this is recreate-able through a MWE. Whenever I compile a standalone TikZ
picture, it compiles all my standalone figures in the same folder. I am using Ubuntu 13.04 and Emacs with server mode running.
Some of this information may be irrelevant, but I am not sure what is needed to troubleshoot such an issue. From the screen shot, I have the main document on the left and my TikZ
picture I am creating on the right. As you can see, I compiled the figure and Latexmk
compiled every other standalone .tex
file too.
Output written on sunplanetspacecraft.pdf (1 page, 1117 bytes).
SyncTeX written on sunplanetspacecraft.synctex.gz.
Transcript written on sunplanetspacecraft.log.
Latexmk: Log file says output to 'sunplanetspacecraft.pdf'
Latexmk: All targets (sunplanetspacecraft.pdf) are up-to-date
Latexmk: All targets (transferchoices.pdf) are up-to-date
Latexmk: All targets (transfergeoa.pdf) are up-to-date
Latexmk: All targets (transfergeob.pdf) are up-to-date
Latexmk: All targets (trigidentities.pdf) are up-to-date
Latexmk: All targets (twobodies3D.pdf) are up-to-date
Latexmk: All targets (unitvec.pdf) are up-to-date
Latexmk: All targets (velcomp.pdf) are up-to-date
Latexmk finished at Thu Jul 25 14:12:06
I am compiling sunplanetspacecraft.tex
and none of the files are related to the to this .tex
file but yet they still were compiled.
I looked through the log file, but I didn't see anything that related to the other files Latexmk
compiled. Below is my preamble in case that helps.
\documentclass[convert = false]{standalone}
\usepackage[utf8]{inputenc}
\renewcommand{\rmdefault}{ppl}
\linespread{1.05}
\usepackage[scaled]{helvet}
\usepackage{courier}
\usepackage{eulervm}
\normalfont
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage[usenames, dvipsnames, svgnames, table]{xcolor}
\usepackage{tikz}
\usetikzlibrary{arrows}
The reason I want to resolve this is because one of the another standalone TikZ
pictures takes about 2minutes to compile which slows down compiling a simple picture.
This problem cropped up with another document. This time my document that calls all my standalone
s in it tried calling an unrelated standalone
just because it was in the same folder.
So a MWE (concept) would be to have a a folder, in the folder at a main.tex
, in the main.tex
, you need have \usepackage{standalone}
, then we have two cases:
-
create two
standalone
s to be called in themain.tex
and compile
the first one. When you compile the second one, it will also
compile the first one. This wont cause the problem I am having
since you are probably creating simple documents (not an issue
though). Just check the output to see if it compile the other one
too. This will be the first issue at the top I mention. Create a
folder called test.main.tex
\documentclass{article} \usepackage{standalone} \usepackage{tikz} \begin{document} test \includestandalone{test1} \includestandalone{test2} \end{document}
test1.tex
\documentclass[tikz, convert = false]{standalone} \begin{document} \begin{tikzpicture} \draw (0, 0) -- (2, 0); \end{tikzpicture} \end{document}
test2.tex
\documentclass[tikz, convert = false]{standalone} \begin{document} \begin{tikzpicture} \draw (0, 0) -- (-2, 0); \end{tikzpicture} \end{document}
So if I compile
test2.tex
,test1.tex
compiles also. This hardly
causes a slow down but you get the idea. - create a standalone not called in the
main.tex
, but this time don't add anything in the file. Just name it and save it no preamble. Even though this file isn't being called by themain.tex
, compiling themain.tex
file will try and compile this file that doesn't even have a preamble. It calls because it has a.tex
extension. In the same folder, createtest3.tex
which is blank no pre-amble or code and save it. Now add a line tomain.tex
and compile. This should cause the error no\begin{document}
in the main file. The document will compile fine though but will constantly have that error.main.tex
is forcing the compiling of a blank.tex
file even though it isn't included.
;; ============ Latexmk setup ============== (defun run-latexmk () (interactive) (let ((TeX-save-query nil) (TeX-process-asynchronous nil) (master-file (TeX-master-file))) (TeX-save-document "") (TeX-run-TeX "latexmk" (TeX-command-expand "latexmk -pdf %O %S" 'TeX-master-file) master-file)) (if (plist-get TeX-error-report-switches (intern master-file)) (TeX-next-error t) (progn (demolish-tex-help) (minibuffer-message "latexmk: done.")))) (add-hook 'LaTeX-mode-hook (lambda () (push '("Latexmk" "latexmk -pdf %S" TeX-run-TeX nil t :help "Run Latexmk on file") TeX-command-list)))
.latexmkrc
setup:
$pdflatex = 'pdflatex –shell-escape -interaction=nonstopmode %O %S -file-line-error -synctex=1';
Best Answer
The difficulty is that both
emacs/auctex
andlatexmk
need to be configured, and there has been a confusion about what belongs where.Auctex
invokeslatexmk
, and thenlatexmk
has the job of invoking other programs, likepdflatex
as needed.The code in
.emacs
is for configuringemacs/auctex
so that it will be able to calllatexmk
. It needs to containCompared with the listing given in the question, there appears
%s
(with lower case) instead of%O %S
and%S
. The%s
denotes the name of the source file on the command line used to startlatexmk
.The code in
.latexmkrc
is for configuringlatexmk
. It needs to containThis specifies to
latexmk
how to make the command line it uses to invokepdflatex
. The%O
and%S
(with upper case) say where to put extra options and the source file. Because of howpdflatex
parses its command line, the%O %S
needs to be at the end of the template for the command line.This answer makes obsolete what appears in an answer to an earlier question on configuring
emacs
to uselatexmk
, at How to make `latexmk` run the appropriate amount of times However, the answers for a basic configuration ofemacs
given in another related question https://stackoverflow.com/questions/2199678/how-to-call-latexmk-in-emacs-and-jump-to-next-error are correct.