GeneralDraft option for text?

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
graeme
Posts: 5
Joined: Wed Jun 17, 2009 8:31 pm

Draft option for text?

Post by graeme »

Hi guys

I always thought I was handy with LaTeX but I'm stuck! I'm trying to write some lecture notes that will either display some text (for my personal copy) or leave a blank space of the same size (that my students will fill in during the lecture) depending on how the file is compiled. Currently I've got the following:

Code: Select all


\newif\iflecturerversion
\lecturerversiontrue  % comment out this line for student's copy

\begin{document}

\iflecturerversion{My worked example goes here which may be spread over several lines and includes equations}\else{\vspace{50mm} }\fi 

Unfortunately I have to hardwire the \vspace length and it gets even more tricky if an example is spread over two pages. Is there a better way than the above? For example, is there a "draft"-type option for text (including text spread over subsequent pages)?

Thanks in anticipation!

Graeme

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Draft option for text?

Post by frabjous »

Hmm. I guess the \phantom{...} command can't span paragraphs, or I'd suggest that.

What about just setting the font color to white? E.g.

Comment out one of the two definitions:

Code: Select all

\usepackage{xcolor}
% Comment out the next line if you want the notes not to show
%\newcommand{\iflectureversiononly}[1]{#1}
%
% Comment out the next line instead if you want the notes to show
\newcommand{\iflectureversiononly}[1]{{\color{white}{#1}}}

\begin{document}
       \iflectureversiononly{Am I here, or am I not?}
\end{document}
But someone here probably knows of a better solution. There's probably a package just for this.
phi
Posts: 577
Joined: Tue Oct 21, 2008 8:10 pm

Draft option for text?

Post by phi »

If you only change the color, your students will be able to access the hidden text by selecting it. A better method puts everything in a box:

Code: Select all

\newif\iflectureversion
\newsavebox{\notesbox}
\newenvironment{lectureversion}{%
  \begin{lrbox}{\notesbox}%
}{%
  \end{lrbox}%
  \iflectureversion
    \usebox{\notesbox}%
  \else
    \vspace{\dimexpr\ht\notesbox+\dp\notesbox}%
  \fi
}
graeme
Posts: 5
Joined: Wed Jun 17, 2009 8:31 pm

Re: Draft option for text?

Post by graeme »

The white text is a smart idea - thanks frabjous :D But while it doesn't prevent pictures from being displayed a minor tweak that incoorporates a vspace of the same dimensions as the picture has done the trick.

Also phi's suggestions works great for a short line of text. However when the text runs over a single line or also includes equations etc, it doesn't work properly. But thanks anyway phi!
opietaylor
Posts: 1
Joined: Sat Aug 22, 2009 8:47 pm

Draft option for text?

Post by opietaylor »

I found that

Code: Select all

\newcommand{\studentblank}[1]{\underline{{\color{white}{\LARGE{#1}}}}}
will make a blank to fill in and leave a little extra room. Thanks for the tips!
Post Reply