# How can I comment out specific parts of both text and equations by a general command/switch? [closed]

I want to define a command or switch at the top of my document that will seamlessly include/exclude all the explanatory notes and lines of working that don't need to be in a final paper (but are handy if I need to revisit a topic). This should work for both text and lines within equation environments (and ideally captions, or any other place one might like to expand on a concept). If one command can't achieve this, I am open to defining a new command that specifically deals with the various equation environments (multline, split, eqnarray).

I am ok with the idea that the command may need closing before an environment change is made, although of course it would be simpler to use if it persisted from text to equation, and vice versa.

I cannot use \comment or \note, since the journal's template redefines/precludes these commands.

As per (One Command to Rule Both Colored Text and Invisible Text), this:

% define an environment for verbose notes
\newcommand{\verbose}[1]{\textcolor{blue}{#1}}
% and then when it’s time for the paper, you replace this with
%\newcommand{\verbose}[1]{}


works fine for general text, but when I use it across an alignment & or \\ in a split environment, it does not compile properly.

Modifying the command to: \newcommand{\verbose}[1]{\textcolor{blue}{#1}\\} (and any \verbose{...}\\ to \verbose...}) gets around having extra carriage returns when an intermediate equation line is invisible, but it breaks the flow in any text paragraph that continues after a \verbose{...} comment, and still has issues across alignment & marks.

M(N)WE

\documentclass{report}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{color}
% define an environment for verbose notes
%\newcommand{\verbose}[1]{\textcolor{blue}{#1}}
% and then when it’s time for the paper, you replace this with
\newcommand{\verbose}[1]{}
\begin{document}

Lorem ipsum... \verbose{LOREM IPSUM.} This text should follow on in the same paragraph.

$$\begin{split} a&=b\\ b&=c\\ \therefore a&=c\\ &\verbose{by~some~logic}\\ c&=d\\ &\verbose{=d} \end{split}$$
continuing text; also
$$\begin{split} a&=b\\ \verbose{c&=d}\\ e&=f \end{split}$$
final text; note the vertical separation above this compared to previous text.
\end{document}

• Welcome to TeX.SE! – Mico Feb 18 '16 at 22:04
• Have you had a look at the todonotes' package or one of the other related packages? – Andrew Swann Feb 24 '16 at 7:45
• I have; todonotes does not achieve what I want, which is to be able to easily switch between a concise and verbose version of the document, both in prose and in mathematics. fixme only reports in the margin or stdout, todo makes a list of things to fix (not the inline expanded comments that I want), fixmetodonotes similar, and easy-todo is also set up more for collaboration or evolution of a document instead of expansion of concepts. notes and comment have the desired functionality for prose, but conflict with the journal template I am stuck with. Also, they can't handle math. – Thesquare Mar 1 '16 at 4:57
• I'm quite happy with defining a simple color difference for the verbose text; I have no need for fancy boxes around the inserted comments. The document format should not be affected by the inclusion/exclusion of portions of the text; the verbose text should seamlessly (apart from color) integrate into the whole. – Thesquare Mar 1 '16 at 5:02
• In fact, it would be very useful to be able to designate entire equations (i.e. \verbose{$$...$$ }`) as verbose comment, as well as just some lines or parts of lines. – Thesquare Mar 1 '16 at 6:06