Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

In the following, why is the exclamation mark (!) repeated in the error message?

\def\error#1#2{%
  \begingroup
  \errhelp{#2}%
  \errmessage{^^J! package Error: #1^^J}%
  \endgroup
}
\error{Stop now.}{Hi, don't go on.}


! 
! package Error: Stop now.
share|improve this question
1  
Formatting error messages is tricky. See the steps in latex.ltx or similar (but with word-wrapping and other goodies) in l3msg. –  Joseph Wright Oct 3 '12 at 7:13

1 Answer 1

up vote 4 down vote accepted

The first exclamation mark is provided by \errmessage itself:

\def\error#1#2{%
  \begingroup
    \errhelp{[ERRHELP: #2]}%
    \errmessage{[ERRMESSAGE: #1]}
  \endgroup
}
\error{Stop now.}{Hi, don't go on.}

The .log file:

This is TeX, Version 3.1415926 (TeX Live 2011)
(./test.tex
! [ERRMESSAGE: Stop now.].
\error ...HELP: #2]}\errmessage {[ERRMESSAGE: #1]}
                                                   \endgroup 
l.7 \error{Stop now.}{Hi, don't go on.}

? h
[ERRHELP: Hi, don't go on.]
? x
No pages of output.
Transcript written on test.log.
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.