2

I am using the following

\newcommand{\PERSONALNOTE}[1]{\textcolor{red}{#1}}

for the purpose of inserting personal notes when writing; so that I can turn it off when building final article simply by changing the line to

\newcommand{\PERSONALNOTE}[1]{}

The problem is that this code is quite fragile. I can't make paragraphs (double line breaks). I want to convert this into something akin to a

\newtheorem{pnote}{Personal Notes}

which is better since I have numbering but I don't know how to turn off those pnote block when I want to build note-free final version.

3
  • \newcommand{\PERSONALNOTE}[1]{{\color{red}{#1}}} Jan 25, 2018 at 22:29
  • 3
    Are you aware of the nice todonotes package?
    – user121799
    Jan 25, 2018 at 22:31
  • @marmot Now I am. Thanks for the recommendation.
    – An Hoa
    Jan 25, 2018 at 22:35

1 Answer 1

3

That you use show is not a true environment (e.g.: \begin{pnote} ... \begin{pnote}), but a macro with one argument (\pnote{....}).

Although what you want can be easily done with a macro as show David's comment, for long notes with several paragraphs, and maybe list, tables, etc., . it will be more convenient a true environment. One reason is that there are not problem with blank lines, but maybe more important is that the stard and end are both semantically meaningful. In long notes with the help of a macro will be hard to see where end the argument or what exactly close a lonely } when in several lines before there are not any { (and also if there are many, although some editor can help in this task highlighting the right one).

Make a true environment is very easy:

\documentclass{article}
\usepackage{xcolor,lipsum}
\newenvironment{pnote}{\color{blue}}{}
\begin{document}
    \lipsum[1]
    \begin{pnote}
        \lipsum[2-3]
    \end{pnote}
    \lipsum[4]
\end{document}

If you want hide the personal notes as comments of the verbatim package, the simplest is load the package and \let\pnote\comment (and \let\endpnote\endcomment if you typed something in the second argument on the environment definition of pnote). If you want to turn they in normal text instead of hiding, obviously you can \renewenvironment{pnote}{}{} or even \let\pnote\normalsize.

On the other hand, seem that you also want numbered harders for the notes, so the MWE could end in in something as:

\documentclass{article}
\usepackage{verbatim}
\usepackage{xcolor}
\usepackage{lipsum}

% to show notes in blue with counter
\newcounter{personaln}
\newenvironment{pnote}{\color{blue}
\stepcounter{personaln}
\par\bigskip\noindent{\bfseries Personal note \arabic{personaln}:}
\par\medskip}{\par\medskip} 

% Uncomment the next line to show notes as normal text  
% \renewenvironment{pnote}{}{} 

% Uncomment the next lines to hide the notes
% \let\pnote\comment
% \let\endpnote\endcomment 

\begin{document}
    \large
    \lipsum[1]
    \begin{pnote}
        \lipsum[2-3]
    \end{pnote}
    \lipsum[4]
\end{document}

Said that, it is also easy hide/unhide notes using todonotes.

3
  • My problem is more on how would I toggle between displaying and not displaying note by simply redefining the environment? In other words, is there a way to make an environment pnote as alias for comment in verbatim package?
    – An Hoa
    Jan 26, 2018 at 22:51
  • @AnHoa I I edited my answer, I hope that solving all the issues.
    – Fran
    Jan 27, 2018 at 9:02
  • That was fantastic, exactly as I wanted. Thanks for the tip with \let.
    – An Hoa
    Jan 27, 2018 at 18:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .