Your code here
\else
Another code
\fi
Then, compile with
xelatex or pdflatex -job-name=myfilexx "\def\myflag{}\input{myfile}"
\newif\ifsoln \solnfalse
\solntrue %% Comment out if not compile the block..
\begin{document}
\ifsoln
Your code here
\fi
===========================
\usepackage{ifthen}
\newboolean{prob}
\setboolean{prob}{false} % boolvar=true or false
\begin{document}
\ifthenelse {\boolean{prob}}{Code if true}{Code if false}
============================
\usepackage{comment}
\includecomment{soln}
\excludecomment{soln}
\begin{soln}
xxxx
\end{soln}
Alternatively,
xelatex '\AtBeginDocument{\includecomment{soln}}\input{syllabus}'
or create a makefile with the following contents
student:
latex '\AtBeginDocument{\excludecomment{soln}}\input{syllabus}'
teacher:
latex '\AtBeginDocument{\includecomment{soln}}\input{syllabus}'
Put the following at the first line will also set the output filename
%& -job-name=somename
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-- Using if then in the preamble
\
newcommand{\isitthree}[1]
{
\ifnum#1=3
number #1 is 3
\else
number #1 is not 3
\fi
}
\newif\ifismonday
\newif\ifistuesday
\ismondayfalse
\istuesdaytrue
\ifismonday
sucks!
\else
\ifistuesday
almost sucks.
\else
is \textbf{great}
\fi
\fi
=======================================================
\usepackage{ifthen}
\newboolean{includethis}
\setboolean{includethis}{false}
\newcommand{\ifinclude}[1]{\ifthenelse{\boolean{includethis}}{#1}{}}
Then if you do
\ifinclude{%
\begin{frame}{Slide title}
This slide will be hidden.
\end{frame}
}
the frame will be included only if you change the setting of
the boolean variable includethis to 'true' in the preamble.
======================================================
In your source file, write
\providecommand{\comment}[1]{\emph{#1}}% fallback definition
and then compile the LaTeX document ("myfile.tex") as
pdflatex (whatever options you need) "\newcommand\comment[1]{\textbf{#1}}\input{myfile}"
No comments:
Post a Comment