Newsgroups: comp.text.tex
I am now adapting my thesis short for a conference, which requires scaling down all my headers. I.e., \chapter to \section, \section to \subsection, etc. Besides, all references to "Chapter" would change to "Section" accordingly. Please somebody provide me a macro so that my individual .tex files can suit both cases, so that:
\H1 would be \chapter for my thesis and \section for the conference paper, and \H1Name(what's better name for this?) would be "Chapter" or "Section" accordingly. Thanks!
I would probably have two document classes, and leave the commands as \chapter, \section,…. but in the conference class, \chapter would typeset accordingly. I would use something like smartref.sty (?) for controlling the "Section 4.2" cross referencing.
Donald Arseneau
I just finished my thesis a few months ago, and I was using the following to be able to have one .tex file for both the official thesis version and for a paper to be submitted. You'll obviously have to change it to suit your needs, but it might get you started. Basically you decide which of the two documentclasses you want to use (uncomment the appropriate one), and then you \setboolean the isthesis variable. then you get a command "\ifthesis{}{}" that takes two arguments, and depending on whether you're set at thesis mode or not will substitute the first or the second argument for that command. You can see at the end of this snippet how I redefine "\sec" and "\subsec" to do what you want with sectioning, but this goes much farther — if you have a lemma you want in the thesis but not in the paper, put it in an \ifthesis command, etc.
% To typeset as a thesis, use the uclathes documentclass line, and change the % ``isthesis'' variable to ``true''. % To typeset as a paper, use the ``amsart'' documentclass line, and change the % ``isthesis'' variable to ``false''. %\documentclass[PhD]{uclathes} \documentclass[12pt]{amsart} \usepackage{ifthen} \newboolean{isthesis} % Is this being typeset for thesis purposes or paper % purposes? \setboolean{isthesis}{false} %\setboolean{isthesis}{true} %Usage: \ifthesis{thesiscommands}{papercommands} \newcommand{\ifthesis}[2]{\ifthenelse{\boolean{isthesis}}{#1}{#2}} \ifthesis{}{ \usepackage[margin=1in]{geometry} } \ifthesis{\usepackage{oldlfont}} \begin{document} \ifthesis{}{\Now \ \ $Revision: 1.74 $} \ifthesis{ \renewcommand{\sec}{\chapter} \newcommand{\subsec}{\section} }{ \renewcommand{\sec}{\section} \newcommand{\subsec}{\subsection} } [...]
Ami Fischman
Newsgroups: comp.text.tex
> > \H1 would be \chapter for my thesis and \section for the conference > Hmm, just want to confirm that numbers are not allowed in command, > correct? Meaning that I can't define commands like \H1, \H2, etc?
Yes and no. You can make
\def\H#1{\csname H#1\endcsname}
and then define
\expandafter\def\csname H1\endcsname{\chapter} \expandafter\def\csname H2\endcsname{\section}
David Kastrup