TikZpicture 코딩을 삭제하지 않고 무력화하는 방법은 무엇입니까?

TikZpicture 코딩을 삭제하지 않고 무력화하는 방법은 무엇입니까?

아래에 표시된 것과 유사한 100개 이상의 tikz 사진이 포함된 문서가 있습니다.

나는 (가능하다면 쉽게) 해당 코드 세트에서 두 개의 서로 다른 문서를 생성하고 싶습니다.---(1) 있는 그대로; (2) tikzpictures를 제외한 모든 것.

문서 코드를 복사한 다음 100개 이상의 tikz 사진을 모두 수동으로 삭제할 수 있다는 것을 알고 있습니다. 하지만 제가 찾고 있는 것을 생성할 수 있는 더 좋은 방법이 있기를 바랍니다.

코드를 고려해보세요:

\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}

이는 다음을 생성합니다.

여기에 이미지 설명을 입력하세요

여기에 이미지 설명을 입력하세요

tikzpicture질문: LaTeX가 코딩을 실행하지 않고 출력에 텍스트만 나타나도록 위 코드를 수정하는 (상당히 간단한) 방법이 있습니까 ? (저는 .로 코드를 컴파일합니다 pdflatex.)

감사합니다.

답변1

패키지 environ및 명령 사용 \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}

답변2

부수적인 영향을 미칠 수 있는지 확실하지 않습니다. 지금은 광범위하게 테스트할 수 없지만 MWE에서는 작동합니다.

\RenewDocumentEnvironment{tikzpicture}{o +b}{}{}

직전 \begin{document}. 기본적으로 tikzpicture아무것도 하지 않도록 환경을 재정의합니다 .

다음과 같이 "표지판"을 쉽게 추가할 수도 있습니다.

\RenewDocumentEnvironment{tikzpicture}{o +b}{\par***Removed tikzpicture***\par}{}또는 그런 것.

해당 줄에 주석을 달거나 주석 처리하면 tikzpicures 컴파일이 전환될지 여부가 전환됩니다.

여기에 이미지 설명을 입력하세요

관련 정보