2

I have some paragraphs in my thesis, that will stay in there until just before it is finished. They should be marked as non-important to my supervisor. Then I'd like to remove those paragraphs all at once.

Instead of \kill I defined the command \rem, which is also good for more than one line.

In the document this looks like this:

Blah blah, very important.
\remm{As we all know, the sky is blue.}
Blah blah, also important.

In my header (above \begin{document}) I want to do something like this:

%current setting
\def\remm{\textcolor[rgb]{0.3,0.3,0.3}}
%\def\remm{\rem} 
%final setting
%\def\remm{\textcolor[rgb]{0.3,0.3,0.3}}
\def\remm{\rem} 

Yet, \textcolor{...} changes the vertical spacing of my document, which is not acceptable.

Do you have any ideas? I can also imagine to put a vertical line along those unimportant paragraphs or something similar.

The minimal example is:

\documentclass[11pt,fleqn,a4paper]{article}
\usepackage{color}

\newcommand{\rem}[1]{}
\def\remm{\textcolor[rgb]{0.3,0.3,0.3}}
%\def\remm{\rem}

\begin{document}
Blah blah, very important.
\remm{
As we all know, the sky is blue.

more paragraphs following
}
Blah blah, also important.
\end{document}
  • 3
    \textcolor would not change the spacing if you always use it as \remmm{text here... If you use it as you show then ypu have (in one case) a spurious paragraph and (in the other) spurious horizontal white space that will come or go depending on which definition you use – David Carlisle Feb 11 '15 at 17:23
  • I just edited my example: There can be more than one paragraph I want to remove, so \textcolor ruins my vertical spacing – Dan Feb 12 '15 at 8:28
  • No If you put multiple paragraphs into \textcolor you get an error after any error you should not comment on the typographical output, TeX does not try to make a sensible pdf after an error, its recovery action is just intended to allow further debugging not to make sensible output. – David Carlisle Feb 12 '15 at 9:30
3

If you want a command that doesn't leave traces behind it if disabled, you should do

\makeatletter
% final setting
%\newcommand{\remm}[1]{\@bsphack\@esphack}
\makeatother
% draft setting
\newcommand{\remm}[1]{%
  \begingroup % don't make color leak out
  \leavevmode % be sure to be in horizontal mode
  \color[rgb]{0.3,0.3,0.3}% set the color
  #1% set the text
  \endgroup‌ % end the group
}
  • Yeah but this adds vertical spaces again, since I use it on my Theorems and Definitions (\newtheoremstyle etc.) – Dan Feb 12 '15 at 10:25
  • @reinbot Without knowing your use cases, only generic answers can be given. However, why bothering, since you'll use it only in draft versions? – egreg Feb 12 '15 at 11:48
  • @reinbot why do you want to colour \newtheoremstyle ?? – David Carlisle Feb 12 '15 at 13:08
0

I just solved the issue:

\newcommand{\remm}[1]{}%final setting
\newcommand{\remm}[1]{\color[rgb]{0.3,0.3,0.3}#1\color{black}} %current setting
  • Why not \newcommand{\remm}[1]{\begingroup\leavevmode\color[rgb]{0.3,0.3,0.3}#1\endgroup}? – egreg Feb 12 '15 at 9:12
  • Unlike \textcolor or the version @egreg suggests in the comment using \color in that way will affect spacing. See the color package documentation for advice on using \textcolor rather than \color to avoid bad spacing effects. – David Carlisle Feb 12 '15 at 9:31
  • @DavidCarlisle I did not know that! Who would have thought that \color would affect spacing? I guess I'll have to read the documentation, after all. – Steven B. Segletes Feb 12 '15 at 13:02
  • @StevenB.Segletes the fact that you have gone so long without noticing that \special can affect spacing is testament care with which latex tries to put them in safe places. I wonder who wrote that code? – David Carlisle Feb 12 '15 at 13:05
  • David, You are indeed \special in my book :^). And I see mention of it in the footnote on page 7 of grfguide.pdf. – Steven B. Segletes Feb 12 '15 at 13:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.