[texworks] turning on or off portions of .tex output

Paul A Norman paul.a.norman at gmail.com
Tue Aug 2 02:07:03 CEST 2011


Dear Steve,

You could script this in TeXworks, but I think myself that writing
some LaTeX macros may be preferable, if you can not find what you want
in CTAN.

If you haven't already, check on CTAN http://www.ctan.org/, I recall
seeing a number of useful packages for Tutorial preparation there a
few years ago, which may or may not lend themselves to your needs.
Sorry I can not recall their names.

Otherwise maybe something using package xifthen and its macro
\ifthenelse{}{}{} to provide alternate, or no other text, in each
situation, and testing against a flag you set in the document
preamble. You'd need to handle the math areas with careful thought.

I use this kind of thing in a macro for determining  whether .pdf
output was for printing or electronic use. You might be able to use a
similar scheme...

\ifthenelse{\equal{\electronicPdf}{yes}}{#1}{#2}%

With this set in my project .sty

%: electronic or printed \livePdfPrinted{#1 - live pdf version}{#2 -
printed version}
\newcommand{\electronicPdf}{yes}% if wanted (default) - or put -
\renewcommand{\electronicPdf}{no} in document preamble
\newcommand{\electronicOrPrinted}[2]{
\ifthenelse{\equal{\electronicPdf}{yes}}{#1}{#2}%
}

And through my document I write as required ...

\electronicOrPrinted{stuff for electronically read version of
pdf}{stuff for print version}

One or other can be left blank or use a space filler.

Any way further (especially non TeXworks) discussion of this sort of
thing may be better somewhere else like
http://groups.google.com/group/latexusersgroup?hl=en --- and among
others people like Peter Flynn is on that group, who would have a much
better take on these sorts of LaTeX things.

Paul


On 2 August 2011 05:07, Gadbois, Steve <Steve.Gadbois at musowls.org> wrote:
> I have a TeX document for which I wish to be able to turn “on” or “off”
> selected portions of text in the typeset result, without painstakingly
> changing the .tex file each time.  (Thus, for example, I do NOT wish to
> comment out certain lines, with %, only to undo, redo, etc. later.)  Of
> course, I am willing to insert appropriate markers or delimiters in the .tex
> file once, and then somehow externally “flip a switch” to either print or
> not print the selected portion(s).  Ideally, I’d even like to be able to
> turn on or off within  {$  $}  or within  {$$  $$} .  Is anyone aware of a
> method?  Thanks.
>
>
>
> My application is a class handout for which I wish to have both a complete
> version as well as an outline version to hand out to students, with key
> elements (e.g., proofs) omitted because they will be filled in during class
> (in an attempt to keep students fully engaged).  Since the handout will
> constantly evolve, I don’t want to keep and constantly update parallel
> versions.
>
>



More information about the texworks mailing list