0

How to replace the C-like code ?

\documentclass{book}

% C-like code : #define FinalCompilationBooleanIsOn 1
% C-like code : if FinalCompilationBooleanIsOn {

    \usepackage{pst-all}
    \usepackage[crop=off]{auto-pst-pdf}

% C-like code : }

\begin{document} 

% C-like code : if FinalCompilationBooleanIsOn {

    \begin{pspicture}
    \psframe*[linecolor=blue](10,10)
    \end{pspicture}

% C-like code : }

\end{document}

1 Answer 1

1

Like this :

\documentclass{book}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%% usepackages %%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\usepackage{etoolbox}

\newbool{FinalCompilation}

\boolfalse{FinalCompilation}
%\booltrue{FinalCompilation} % uncomment if needed

\ifbool{FinalCompilation}{ % fork for packages, before document

    \usepackage{pst-all}
    \usepackage[crop=off]{auto-pst-pdf}

}{} % the 'else' is left empty here

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%% end of usepackages %%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% beginning of the document %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document} 

\ifbool{FinalCompilation}{ % fork inside the document, same syntax

        \begin{pspicture}
        \psframe*[linecolor=blue](10,10)
        \end{pspicture}

}{Normal text : graphic not included.} % the 'else' is used here

\end{document}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%% end of the document %%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .