I have a \comments
macro that inserts three centered asterisks (* * *
) and changes font size and color. A corresponding \nocomments
macro adds another break with centered asterisks and restores standard font size and color.
I would like the \comments
macro to be section heading sensitive, that is, after \chapter
, \section
, \subsection
and their friends I would like to suspend output of the tree asterisks and only change font size and color.
In other words, directly after a heading, the macro should change font size and color, but in all other cases also output the 'anonymous break' (* * *
).
I have tried looking into core latex constructs such as \if@nobreak
, but it seems that a solution to this is not that simple.
And yes, this could be done with a \newenvironment
as well, but since I use pandoc as front-end, using simple macros bypasses pandoc's automatic detection of environments. Anyway, a solution for macros will probably work with environments too.
A not-so-well-working example:
\documentclass{article}
\usepackage{xcolor}
\newcommand{\comments}{%
\begingroup
\color{blue}
% The following line should be suspended if `\begincomments' is used
% directly after a sectioning command such as `\section' or
% `\subsection'. This is just yet another of my attempts that does
% not work.
\if@noskipsec\else
\begingroup\centering * * *\par\endgroup
\fi
\small
\setlength{\parindent}{0mm}
\setlength{\parskip}{.5\baselineskip}
}
\newcommand{\nocomments}{%
\begingroup\centering * * *\par\endgroup
\endgroup
}
\begin{document}
\section{Section header}
\comments
Some comments about what will be written in this section, but is not
yet written. It should not start with three asterisks.
\nocomments
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat. Duis aute irure dolor in
reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
culpa qui officia deserunt mollit anim id est laborum.
\comments
More comments. This should, however, start with three asterisks.
\nocomments
\end{document}
\documentclass{...}
and ending with\end{document}
.