
MATLAB에서 가져온 tex 파일이 있습니다.
\begin{tikzpicture}
\begin{axis}[%
width=\figurewidth,
height=\figureheight,
scale only axis,
xmin=1,
xmax=5,
ymin=2,
ymax=10
]
\addplot [color=red,line width=4.0pt,only marks,mark=*,mark options={solid},forget plot]
table[row sep=crcr]{
1 2 \\
2 4 \\
3 6 \\
4 8 \\
5 10 \\
};
\end{axis}
\end{tikzpicture}%
나는 그 안에 xlabel
추가 하고 싶다 .ylabel
xmin=1,
xmax=5,
ymin=2,
ymax=10,
xlabel=X,
ylabel=Y,
언급한 것처럼 다른 라텍스 파일을 실행하면여기.
\documentclass{minimal}
\newwrite\tempfile
\begin{document}
\immediate\openout\tempfile=lists.tex
\immediate\write\tempfile{xlabel=X,}
\immediate\write\tempfile{ylabel=Y,}
\immediate\closeout\tempfile
\input{lists}
\end{document}
특정 줄에 이것을 쓸 수 있나요?
답변1
키 xlabel
및 ylabel
설정도 가능합니다.밖의matlab에서 를 tikzpicture
통해 \pgfplotsset
, 예:
\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\newdimen\figurewidth
\newdimen\figureheight
\begin{document}
\begingroup
\pgfplotsset{xlabel=$X$, ylabel=$Y$}
\setlength{\figurewidth}{5cm}
\setlength{\figureheight}{5cm}
% Matlab export
\begin{tikzpicture}
\begin{axis}[%
width=\figurewidth,
height=\figureheight,
scale only axis,
xmin=1,
xmax=5,
ymin=2,
ymax=10
]
\addplot [color=red,line width=4.0pt,only marks,mark=*,mark
options={solid},forget plot]
table[row sep=crcr]{
1 2 \\
2 4 \\
3 6 \\
4 8 \\
5 10 \\
};
\end{axis}
\end{tikzpicture}%
\endgroup
\end{document}
답변2
emacs 교체-regexp 기능만 사용하는 솔루션:
M-x replace-regexp RET \(ymax=[0-9]+\) RET \1, C-q C-j xlabel=X, C-q C-j ylabel=Y