Proper answer:
There are several things at play here. First of the MWE contains some 60+ invisible unicode chars (U+200E, LEFT-TO-RIGHT MARK). Compiling the MWE with pdflatex causes an error about unicode 200E being unknown to pdflatex.
In xelatex things are different, it knows about unicode and to it these invisible chars are just normal chars.
In the first line of the MWE, there is an U+200E at the end of the line. Xelatex will try to typeset this char, but is not allowed as we are in the preamble, hence the
LaTeX Error: Missing \begin{document}
You get the same error using \documentclass{article} a
The other error messages are presumably caused by your editor running in something like nonstopmode
aka, if it gets an error try to recover, that guess does not always go so well and errors may accumulated. Therefore one always concentrate on fixing the first error.
In the earlier text below. you'll find my markup of where the 200E chars are hiding in the doc.
Here is a cleaned version:
\documentclass[10pt]{article}
% Allow Unicode input (alternatively, you can use XeLaTeX or LuaLaTeX)
% \usepackage[utf8]{inputenc}
\usepackage{microtype, xparse, tcolorbox}
\newenvironment{reviewer-comment}{}{}
\tcbuselibrary{skins}
\tcolorboxenvironment{reviewer-comment}{empty, left=1em, top=1ex,
bottom=1ex, borderline west={2pt}{0pt}{black!20},}
\ExplSyntaxOn
\NewDocumentEnvironment{response}{+m O{black!20}}{
\IfValueT{#1}{
\begin{reviewer-comment~}
\setlength\parindent{2em}
\noindent
\ttfamily #1
\end{reviewer-comment~}
}
\par\noindent\ignorespaces
}{\bigskip\par}
\NewDocumentCommand \Reviewer {m} {
\section*{Comments~by~Reviewer~#1}
}
\ExplSyntaxOff
\AtBeginDocument{\maketitle\thispagestyle{empty}\noindent}
% You can get probably get rid of these definitions:
\newcommand\meta[1]{$\langle\hbox{#1}\rangle$}
\newcommand\PaperTitle[1]{``\textit{#1}''}
\title{Statement on the Revision of \meta{Paper ID} \\
Based on the Referees' Report}
\author{Author1 \and Author2 \and Author3}
\date{\today}
\begin{document}
This statement concerns our revision of the \meta{Paper ID} paper,
entitled \PaperTitle{\meta{Paper Title}}, based on the referees'
report.
\Reviewer{\#1}
\begin{response}{First comment.}
Response to the first comment.
\end{response}
\begin{response}{Second comment.}
Response to the second comment.
\end{response}
\Reviewer{\#2}
\begin{response}{First comment.}
Response to the first comment.
\end{response}
\end{document}
Running this through xelatex we get the error
! LaTeX Error: Environment reviewer-comment undefined.
which is caused by defining that env as reviewer-comment~
note the tilde at the end. Under \ExplSyntaxOn
the char ~
is an explict space. So reviewer-comment
is not defined whereas reviewer-comment
(space at the end) is.
Just remove those two ~
and it works just fine.
BTW you are not using any code that needs \ExplSyntaxOn
the interfaces explained in the xparse
manual does not need it.
Earlier text:
Too long for comment, here is what the MWE looks like after I run it through my "look for unicode chars pdfLaTeX does not support", \NOPE
just markes the position and the number of the char. All those \NOPE{200e}
makes pdflatex croak. I have no idea what is wrong with your writing env since it adds all those otherwise hidden chars.
It seems pdflatex is a lot better at complaining about unicode issues than xelatex.
You can copy the MWE into https://w3c.github.io/xml-entities/unicode-names.html, to see what chars it is made of.
You get U+200e LEFT-TO-RIGHT MARK ‎
all over the place. These are invisible, but counts as chars in the preamble by xelatex and lualatex so you get an error.
BTW If I remove the 200E chars from the MWE, and remove the ~
in \begin/end{reviewer-comment~}
, then the MWE compiles just fine i both pdflatex and xelatex (testing under TeX Live 2018)
\documentclass[10pt]{article}\NOPE{200e}
% Allow Unicode input (alternatively, you can use XeLaTeX or LuaLaTeX)
% \NOPE{200e}\usepackage[utf8]{inputenc}\NOPE{200e}
\usepackage{microtype, xparse, tcolorbox}\NOPE{200e}
\newenvironment{reviewer-comment}{}{}\NOPE{200e}
\tcbuselibrary{skins}\NOPE{200e}\NOPE{200e}\NOPE{200e}
\tcolorboxenvironment{reviewer-comment}{empty\NOPE{200e}, \NOPE{200e}left=1em\NOPE{200e}, \NOPE{200e}top=1ex\NOPE{200e},
\NOPE{200e}bottom=1ex\NOPE{200e}, \NOPE{200e}borderline west={2pt}{0pt}{black!20}\NOPE{200e},}
\NOPE{200e}\ExplSyntaxOn\NOPE{200e}
\NOPE{200e}\NewDocumentEnvironment{response}\NOPE{200e}{\NOPE{200e}+\NOPE{200e}m O{black!20}\NOPE{200e}}{
\IfValueT{#1}\NOPE{200e}{
\begin{reviewer-comment~}\NOPE{200e}
\setlength\parindent{2em}\NOPE{200e}
\noindent\NOPE{200e}
\NOPE{200e}\ttfamily #1\NOPE{200e}
\NOPE{200e}\end{reviewer-comment~}\NOPE{200e}
}
\par\noindent\ignorespaces\NOPE{200e}\NOPE{200e}
}{\NOPE{200e}\bigskip\par\NOPE{200e}}
\NOPE{200e}\NewDocumentCommand \Reviewer {m}\NOPE{200e} {
\section*{Comments~by~Reviewer~#1}\NOPE{200e}
}
\ExplSyntaxOff\NOPE{200e}
\AtBeginDocument{\maketitle\thispagestyle{empty}\noindent}\NOPE{200e}
% \NOPE{200e}You can get probably get rid of these definitions\NOPE{200e}:
\newcommand\meta[1]{$\langle\hbox{#1}\rangle$}\NOPE{200e}
\newcommand\PaperTitle[1]{``\textit{#1}''}\NOPE{200e}
\title{Statement on the Revision of \meta{Paper ID} \\NOPE{200e}
Based on the Referees' Report}\NOPE{200e}
\author{Author1 \and Author2 \and Author3}\NOPE{200e}
\date{\today}\NOPE{200e}
\NOPE{200e}\begin{document}\NOPE{200e}
\NOPE{200e}This statement concerns our revision of the \meta{Paper ID} paper\NOPE{200e},
\NOPE{200e}entitled \PaperTitle{\meta{Paper Title}}\NOPE{200e}, \NOPE{200e}based on the referees'\NOPE{200e}
\NOPE{200e}report\NOPE{200e}.
\Reviewer{\#1}\NOPE{200e}
\begin{response}{First comment.}\NOPE{200e}
Response to the first comment\NOPE{200e}.
\NOPE{200e}\end{response}\NOPE{200e}
\begin{response}{Second comment.}\NOPE{200e}
Response to the second comment\NOPE{200e}.
\NOPE{200e}\end{response}\NOPE{200e}
\NOPE{200e}\Reviewer{\#2}\NOPE{200e}
\NOPE{200e}\begin{response}{First comment.}\NOPE{200e}
\NOPE{200e}Response to the first comment\NOPE{200e}.
\NOPE{200e}\end{response}\NOPE{200e}\NOPE{200e}
\NOPE{200e}\end{document}
EDIT: here is the MEW again, cleaned of all the U+200E's, run it through pdflatex or xelatex and the error is completely different, related to the ~
in the definition of reviewer-comment~
\documentclass[10pt]{article}
% Allow Unicode input (alternatively, you can use XeLaTeX or LuaLaTeX)
% \usepackage[utf8]{inputenc}
\usepackage{microtype, xparse, tcolorbox}
\newenvironment{reviewer-comment}{}{}
\tcbuselibrary{skins}
\tcolorboxenvironment{reviewer-comment}{empty, left=1em, top=1ex,
bottom=1ex, borderline west={2pt}{0pt}{black!20},}
\ExplSyntaxOn
\NewDocumentEnvironment{response}{+m O{black!20}}{
\IfValueT{#1}{
\begin{reviewer-comment~}
\setlength\parindent{2em}
\noindent
\ttfamily #1
\end{reviewer-comment~}
}
\par\noindent\ignorespaces
}{\bigskip\par}
\NewDocumentCommand \Reviewer {m} {
\section*{Comments~by~Reviewer~#1}
}
\ExplSyntaxOff
\AtBeginDocument{\maketitle\thispagestyle{empty}\noindent}
% You can get probably get rid of these definitions:
\newcommand\meta[1]{$\langle\hbox{#1}\rangle$}
\newcommand\PaperTitle[1]{``\textit{#1}''}
\title{Statement on the Revision of \meta{Paper ID} \\
Based on the Referees' Report}
\author{Author1 \and Author2 \and Author3}
\date{\today}
\begin{document}
This statement concerns our revision of the \meta{Paper ID} paper,
entitled \PaperTitle{\meta{Paper Title}}, based on the referees'
report.
\Reviewer{\#1}
\begin{response}{First comment.}
Response to the first comment.
\end{response}
\begin{response}{Second comment.}
Response to the second comment.
\end{response}
\Reviewer{\#2}
\begin{response}{First comment.}
Response to the first comment.
\end{response}
\end{document}
The error you get with the U+200E in the document is related to the error you get if you type
\documentclass{article} a
That single a
will cause an error like
LaTeX Error: Missing \begin{document}.
as you are trying to typeset something in the preamble. pdflatex sees U+200E as an undefined char and complains. xelatex and lualatex klnows unicode and just sees it as a char (like a
) tying to the typeset in the preamble.
The other error messages are probably artefacts because of the runmode your editor is using (ignoring errors).
\documentclass
line when copying the MWE to my editor and compiling it.