
Eu tenho um documento que contém mais de cem imagens tikz semelhantes às vistas abaixo.
Eu gostaria de (facilmente, se possível) produzir dois documentos diferentes desse conjunto de códigos --- (1) como está; e (2) tudo menos as imagens tikz.
Eu sei que poderia copiar o código do documento e excluir manualmente todas as mais de 100 imagens tikz --- mas espero que haja uma maneira melhor de produzir o que estou procurando.
Considere o código:
\documentclass[a5paper,12pt,openany]{book}
\usepackage[paperwidth=5.5in,paperheight=8.25in]{geometry}
\textwidth=4.25in \textheight=7.0in \voffset -7pt
\usepackage[tracking=true]{microtype}
\usepackage{tikz,lipsum}
\usepackage{mathptmx}
\definecolor{lightblue}{RGB}{197,213,255}
\begin{document}
\thispagestyle{empty}
\parskip 10pt
\lipsum[13]
\begin{center}
\begin{tikzpicture}[pencildraw/.style={ %
decorate,
decoration={random steps,segment length=4pt,amplitude=2.5pt}
} %
]
\node[preaction={fill=black,opacity=.7,transform canvas={xshift=1mm,yshift=-1mm}},
%pencildraw,
draw,fill=lightblue,text width=0.85\textwidth,inner sep=4mm]
{\begin{minipage}{3.42in} \footnotesize
\selectfont \textbf{\lipsum[13]} \hfill \textbf{\emph{---L. Iipsum}} \end{minipage}};
\end{tikzpicture}
\end{center}
\lipsum[13]
\begin{center}
\begin{tikzpicture}[pencildraw/.style={ %
decorate,
decoration={random steps,segment length=4pt,amplitude=2.5pt}
} %
]
\node[preaction={fill=black,opacity=.7,transform canvas={xshift=1mm,yshift=-1mm}},
%pencildraw,
draw,fill=lightblue,text width=0.85\textwidth,inner sep=4mm]
{\begin{minipage}{3.42in} \footnotesize
\selectfont \textbf{\lipsum[13]} \hfill \textbf{\emph{---L. Iipsum}} \end{minipage}};
\end{tikzpicture}
\end{center}
\lipsum[13]
\begin{center}
\begin{tikzpicture}[pencildraw/.style={ %
decorate,
decoration={random steps,segment length=4pt,amplitude=2.5pt}
} %
]
\node[preaction={fill=black,opacity=.7,transform canvas={xshift=1mm,yshift=-1mm}},
%pencildraw,
draw,fill=lightblue,text width=0.85\textwidth,inner sep=4mm]
{\begin{minipage}{3.42in} \footnotesize
\selectfont \textbf{\lipsum[13]} \hfill \textbf{\emph{---L. Iipsum}} \end{minipage}};
\end{tikzpicture}
\end{center}
\end{document}
que produz:
PERGUNTA: Existe uma maneira (razoavelmente simples) de modificar o código acima para que o LaTeX não execute as tikzpicture
codificações e apenas o texto apareça na saída? (Eu compilo o código com pdflatex
.)
Obrigado.
Responder1
Com pacote environ
e comando \RenewEnviron
:
\documentclass[a5paper,12pt,openany]{book}
\usepackage[paperwidth=5.5in,paperheight=8.25in]{geometry}
\textwidth=4.25in \textheight=7.0in \voffset -7pt
\usepackage[tracking=true]{microtype}
\usepackage{tikz,lipsum}
\usepackage{mathptmx}
\definecolor{lightblue}{RGB}{197,213,255}
\usepackage{environ} %change
\RenewEnviron{tikzpicture}{}{}
\begin{document}
\thispagestyle{empty}
\parskip 10pt
\lipsum[13]
\begin{center}
\begin{tikzpicture}[pencildraw/.style={ %
decorate,
decoration={random steps,segment length=4pt,amplitude=2.5pt}
} %
]
\node[preaction={fill=black,opacity=.7,transform canvas={xshift=1mm,yshift=-1mm}},
%pencildraw,
draw,fill=lightblue,text width=0.85\textwidth,inner sep=4mm]
{\begin{minipage}{3.42in} \footnotesize
\selectfont \textbf{\lipsum[13]} \hfill \textbf{\emph{---L. Iipsum}} \end{minipage}};
\end{tikzpicture}
\end{center}
\lipsum[13]
\begin{center}
\begin{tikzpicture}[pencildraw/.style={ %
decorate,
decoration={random steps,segment length=4pt,amplitude=2.5pt}
} %
]
\node[preaction={fill=black,opacity=.7,transform canvas={xshift=1mm,yshift=-1mm}},
%pencildraw,
draw,fill=lightblue,text width=0.85\textwidth,inner sep=4mm]
{\begin{minipage}{3.42in} \footnotesize
\selectfont \textbf{\lipsum[13]} \hfill \textbf{\emph{---L. Iipsum}} \end{minipage}};
\end{tikzpicture}
\end{center}
\lipsum[13]
\begin{center}
\begin{tikzpicture}[pencildraw/.style={ %
decorate,
decoration={random steps,segment length=4pt,amplitude=2.5pt}
} %
]
\node[preaction={fill=black,opacity=.7,transform canvas={xshift=1mm,yshift=-1mm}},
%pencildraw,
draw,fill=lightblue,text width=0.85\textwidth,inner sep=4mm]
{\begin{minipage}{3.42in} \footnotesize
\selectfont \textbf{\lipsum[13]} \hfill \textbf{\emph{---L. Iipsum}} \end{minipage}};
\end{tikzpicture}
\end{center}
\end{document}
Responder2
Não tenho certeza se pode ter efeitos colaterais, não posso testar extensivamente agora, mas funciona no MWE: adicione
\RenewDocumentEnvironment{tikzpicture}{o +b}{}{}
pouco antes \begin{document}
. Basicamente, redefine o tikzpicture
ambiente para não fazer nada.
Você também pode facilmente adicionar uma "placa de sinalização", como
\RenewDocumentEnvironment{tikzpicture}{o +b}{\par***Removed tikzpicture***\par}{}
ou algo assim.
Comentar dentro/fora dessa linha alternaria ou não a compilação de tikzpicures.