Extreme TeX novice, sorry for the length of the example, I wasn't sure what packages were important to replicate the problems. I was trying to create a simple command that I could use to injected labeled comments into an existing document. My comment would be in text color blue and be prefixed with initials ('[XXX]' in this example)
\documentclass[12pt]{article}
\usepackage{cprotect}
\usepackage{amssymb, amsmath, bm, bbm}
\usepackage{adjustbox}
\usepackage{amsmath, amsfonts}
\usepackage{bm, bbm}
\usepackage{graphics, graphicx, color, epsf}
\usepackage{natbib}
\usepackage{xr, zref, hyperref}
\usepackage{etoolbox, siunitx}
%
\usepackage{xcolor}
%
\usepackage{scrextend}
%
\newcommand\xxx[1] {\newline\textcolor{blue}{[XXX] #1}}
\begin{document}
\title{A title}
\author{A person}
\maketitle
\section{A section}
Some section stuff
\xxx{a comment}
\begin{verbatim}
This is
text that
presented 'as-is'
\end{verbatim}
Some more text
\xxx{
abc
\begin{verbatim}
verbatim
\end{verbatim}
}
\end{document}
Generates:
line 37: Argument of \@xverbatim has an extra }. }
line 37: Paragraph ended before \@xverbatim was complete. }
line 37: Extra }, or forgotten \endgroup. }
: Emergency stop.
: Command \@footnotemark has changed.
I tried to define a newenvironment (not shown) used by the command, thinking that perhaps the 'command' couldn't handle nested content, but it didn't help.
I'd like to understand what I have done wrong and how I might figure out such issues in the future.
Find a concise summary of the TeX syntax (not LaTeX, just basic basic TeX).
Understand how to get rid of that footnotemark warning. Is some package redefining that command?
\texttt{verbatim}
to get that font but verbatim makes all the special characters non-special so\frac
just prints \frac rather than making a fraction, that can not work in an argument.\newcommand\xxx{\begingroup\color{blue}[XXX]}
and\newcommand\zzz{\endgroup}
, then write\xxx
before the environment and\zzz
after. Or you can define\newenvironment{blueverbatim}{\color{blue}[XXX]\verbatim}{\endverbatim}
and useblueverbatim
insteadepsf
(unless you are writing this document in the 1980s) also\newline\textcolor
looks wrong you should rarely need\newline