![`-output-directory` 및 입력을 사용할 때 tikz-externalize에서 유효한 makefile 가져오기](https://rvso.com/image/400384/%60-output-directory%60%20%EB%B0%8F%20%EC%9E%85%EB%A0%A5%EC%9D%84%20%EC%82%AC%EC%9A%A9%ED%95%A0%20%EB%95%8C%20tikz-externalize%EC%97%90%EC%84%9C%20%EC%9C%A0%ED%9A%A8%ED%95%9C%20makefile%20%EA%B0%80%EC%A0%B8%EC%98%A4%EA%B8%B0.png)
다음 mwe는 latexmk
'의 -output-directory
옵션과 함께 사용될 때 잘못된 makefile을 생성합니다. (예제는 매뉴얼에서 따왔습니다 pgfplots
)
latexmk mwe.tex -output-directory=build
\documentclass{article}
\usepackage{tikz}
\usepackage{pgfplots}
\usepgfplotslibrary{external}
\tikzexternalize[mode=list and make]
\begin{document}
\input{tikz/figure.tikz}
\end{document}
그리고 아래 파일tikz/figure.tikz
\begin{figure}
\begin{tikzpicture}
\begin{axis}
\addplot {x^2};
\end{axis}
\end{tikzpicture}
\caption{Our first external graphics example}
\end{figure}
메이크파일이 있는 상태에서build/mwe.makefile
ALL_FIGURE_NAMES=$(shell cat mwe.figlist)
ALL_FIGURES=$(ALL_FIGURE_NAMES:%=%.pdf)
allimages: $(ALL_FIGURES)
@echo All images exist now. Use make -B to re-generate them.
FORCEREMAKE:
include $(ALL_FIGURE_NAMES:%=%.dep)
%.dep:
mkdir -p "$(dir $@)"
touch "$@" # will be filled later.
mwe-figure0.pdf:
pdflatex -shell-escape -halt-on-error -interaction=batchmode -jobname "mwe-figure0" "\def\tikzexternalrealjob{mwe}\input{mwe}"
mwe-figure0.pdf: mwe-figure0.md5
mwe.tex
파일이 디렉토리에 없기 때문에 디렉토리 에서 명령을 build
실행하면 작동하지 않습니다. 또한 프로젝트 "루트" 디렉터리에서 실행하면 작동하지 않습니다 .make
build
mwe.figlist
답변1
이 해결책은 더러운 해킹이므로 받아들이지 않을 것이며 누군가가 더 나은 답변을 제공하기를 바랍니다.
현재 제가 가지고 있는 해결 방법은 makefile을 생성하는 데 사용되는 명령을 수정하는 것입니다. 이 아이디어는여기디렉토리 위로 이동을 포함하여 명령을 수정합니다.cd .. &&
출력 디렉토리 설정--output-directory=./build
다음과 같이:
\documentclass{article}
\usepackage{tikz}
\usepackage{pgfplots}
\usepgfplotslibrary{external}
\tikzexternalize[mode=list and make]
\tikzset{%
external/system call={cd .. && pdflatex \tikzexternalcheckshellescape --halt-on-error --interaction=batchmode --output-directory=./build --jobname "\image" "\texsource"},
/pgf/images/include external/.code={%
\includegraphics{build/#1}%
},
}
\begin{document}
\input{tikz/figure.tikz}
\end{document}
새로운 메이크파일 생성
ALL_FIGURE_NAMES=$(shell cat mwe.figlist)
ALL_FIGURES=$(ALL_FIGURE_NAMES:%=%.pdf)
allimages: $(ALL_FIGURES)
@echo All images exist now. Use make -B to re-generate them.
FORCEREMAKE:
include $(ALL_FIGURE_NAMES:%=%.dep)
%.dep:
mkdir -p "$(dir $@)"
touch "$@" # will be filled later.
mwe-figure0.pdf:
cd .. && pdflatex -shell-escape --halt-on-error --interaction=batchmode --output-directory=./build --jobname "mwe-figure0" "\def\tikzexternalrealjob{mwe}\input{mwe}"
mwe-figure0.pdf: mwe-figure0.md5
이제 를 build
사용하여 디렉토리 에서 빌드할 수 있습니다 make -f mwe.makefile
.