Newsgroups: comp.text.tex Date: 1995/04/11
Newsgroups: comp.text.tex Date: 1995/04/11
>Is there a macro package which will work with LaTeX to allow >conditionally included text in a LaTeX document? Or ...
The ifthen package does this. Include in your file the line
\usepackage{ifthen}
Then set your variable to true or false by
\newcommand{\condition}{true} or \newcommand{\condition}{false}.
Then you can use the following statement:
\ifthenelse{\equal{\condition}{true}}{ blah-blah %this is printed iff \condition is set to true } { another blah-blah %this is printed otherwise }
Boris
Newsgroups: comp.text.tex Date: 1999/03/21
thanks to everyone who answered. It was very helpful. In case anyone cares, here is a summary of the problem and the solution (its pretty simple).
The problem: I want to have a latex file for my thesis that compiles the entire thesis, including all chapters and appendices. But I want to edit each indivdual file (chapter) without having to That is, I want to include files whole stand alone compilable latex files (with preambles) into my "master" latex document.
Here is the solution I settled on:
In the "master file" called mythesis.tex I have the following definition for "\setflag", and a bunch of includes:
%%%%%%%%start of file \newcommand{\setflag}{\newif \ifwhole \wholetrue} \documentclass[12pt]{thesis} \usepackage{psfig} \usepackage[square]{natbib} \begin{document} \bibliographystyle{plainnat} \input{chapter0} \newpage \addcontentsline{toc}{chapter}{Table of Contents} \tableofcontents \newpage \addcontentsline{toc}{chapter}{List of Figures} \listoffigures \newpage \addcontentsline{toc}{chapter}{List of Tables} \listoftables \include{chapter1.tex} \include{chapter2.tex} \include{chapter3.tex} \include{chapter4.tex} \include{chapter5.tex} \include{chapter6.tex} \include{chapter7.tex} \include{append1.tex} \include{append2.tex} \include{append3.tex} \include{append4.tex} (etc) \end{document} %%%%%%%%end of file
Then in each chapter I have the following conditional definition for "\setflag":
%%%%%%%%start of file \providecommand{\setflag}{\newif \ifwhole \wholefalse} \setflag \ifwhole\else \documentclass[12pt]{thesis} \usepackage{psfig} \usepackage[square]{natbib} \pssilent \renewcommand{\baselinestretch}{1.5} \small\normalsize \pagenumbering{arabic} \pagestyle{myheadings} \setcounter{page}{54} \setcounter{chapter}{3} \begin{document} \fi %%%%%%%%end of file
Thus, if I compile chapter1.tex, it compiles, no problem. The "if" command is executed (based on who is calling for this file).
Also, I can compile mythesis.tex, and it includes chapter1.tex, and the "if" commands are not executed. Thus it compiles the whole thing. Sweeeet!
cheers, bob
Newsgroups: comp.text.tex
> I'm preparing a document that makes mention of a software > product. The first mention of the product name must be followed by the > registered symbol, but each subsequent mention does not need to > include the symbol.
How about:
\newcommand{\product}{Name\textregistered \renewcommand{\product}{Name}}
That is, \product redefines itself.
Mogens
Steven> That's short, clever, and works. The only part I don't Steven> like is that one must mention the command name and Steven> replacement text twice.
\newcommand\cleverstuff[3]{\newcommand{#1}{#2#3% \renewcommand{#1}{#2}}}
\cleverstuff{\product}{Name}{\textregistered}
David Kastrup