
Eu tenho esse arquivo tex vindo do matlab.
\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}%
Eu quero adicionar xlabel
e ylabel
dentro dele como
xmin=1,
xmax=5,
ymin=2,
ymax=10,
xlabel=X,
ylabel=Y,
se eu executar outro arquivo latex como mencionadoaqui.
\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}
Posso escrever isso em linhas específicas?
Responder1
As teclas xlabel
e ylabel
também podem ser definidasforado tikzpicture
matlab via \pgfplotsset
, por exemplo:
\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}
Responder2
Uma solução usando apenas a função emacs replace-regexp:
M-x replace-regexp RET \(ymax=[0-9]+\) RET \1, C-q C-j xlabel=X, C-q C-j ylabel=Y