Questions tagged [error-writing]
The tag {error-writing} is for questions about producing one's own error (or warning) messages in classes, packages or in a LaTeX file in general.
19
questions
0
votes
2
answers
119
views
A macro to check command expandability
I would like to create a command that checks whether an expression is fully expandable, and crashes if not (ideally printing an error message). I would like to do that without a specific TeX engine in ...
1
vote
0
answers
156
views
Parse LaTeX errors
I would like to extract latex errors in a given log file (in LaTeX). Unfortunately, I have no idea how to extract them reliably, so for now I just take all lines starting with a ! , but is is not very ...
0
votes
0
answers
35
views
\msg_error: how to have shorter indentation and lines starting with ! for correct handling in TeXstudio
My library uses \msg_error (LaTeX3) to create errors like:
! Package robExt Error: On line 16: the pdf file
(robExt)
robustExternalize/robExt-ABC41082ADB6EF46AFE4D61D09630D7A.pdf
(...
0
votes
0
answers
32
views
The lines are changed into green colour and not showing in the main document [duplicate]
I have been writing my thesis, but suddenly the words are not showing in the main file. the Black colored words are showing but not the green colored ones.
4
votes
1
answer
312
views
Bad use of LaTeX3 error messages
What is my error in the code below? It gives :
Missing \endcsname inserted.
<to be read again>
\cs_set_nopar:Npx
l.34 \begin{bdoclatex}[KO]
Code used.
\documentclass{...
3
votes
0
answers
68
views
Are there tricks for detecting whether a `\csname..\endcsname`-thingie went wrong and, if so, delivering additional messages explaining the issue?
For the sake of having expandable tokens expanded before stringification I sometimes combine \csname..\endcsname-expansion with \string as in
\chardef\stopromannumeral=`\^^00
\edef\gobbleToPrefix{%
\...
1
vote
0
answers
25
views
Making tikz stricter about missing coordinates [duplicate]
The following MWE compiles without errors or warnings and produces two tikz pictures:
\documentclass{article}
\usepackage{tikz}
\begin{document}
A picture:
\begin{tikzpicture}
\node[draw] (a) at ...
0
votes
1
answer
67
views
Why do I not get my custom error message in case of "unknown choice for a l3keys.choice"?
I'm trying to issue a custom error message in the case of an unknown choice for a l3keys .choice key. In the following MCE:
I created a custom message Unknown~key~choice,
I defined a key key which ...
2
votes
1
answer
124
views
no helpful error if command used in its own redefinition
Why is it that tex does not (or cannot) produce an error when a command is used in a redefinition of itself? For example the plain file
\def\bf{\bf}
abc {\bf text}
\bye
just freezes, producing no ...
3
votes
3
answers
277
views
Producing an error if a command is not given enough arguments
I have a bunch of \newcommand macros that each take several arguments. Sometimes I forget one of the arguments, and this can lead to the output not being as expected, as in this MWE, where the \foo ...
3
votes
3
answers
249
views
Why use \msg_error:nn(nnnnn) in expl3?
expl3 has several kinds of error/warning types that can be issued during execution, in particular:
\msg_fatal:nn(nnnn) halts the execution;
\msg_critical:nn(nnnn) stops scanning the current file;
\...
0
votes
1
answer
24
views
Large figure with caption partially displayed/unable to spread caption onto the next page
I have tried every option that I can find and am not able to figure out a solution. I have a large figure with subfigures and my boss is requiring very long captions for everything. The problem I am ...
2
votes
1
answer
209
views
Expl3 syntax generate error and warning messages for class and LaTeX
When I do \msg_new:nnnn { module } { errorname } { explenation } and then \msg_warning { module } { errorname } i get Package module Warning:. How can I get it to say Class module Warning: or LaTeX ...
0
votes
1
answer
92
views
Produce error when document exceeds a page length
I tried making an fatal error when the document exceeds a set pagelimit. I think there is some problem with my if statement, because although the document exceeds the limit there is no error. The idea ...
0
votes
2
answers
177
views
How to make "fatal error"?
How do you make LaTeX stop/ abort the compilation and output a "fatal error"?
I know there are a couple of ways to produce errors/warnings:
\ClassError{class-name}{error-text}{help-text}
\...
2
votes
1
answer
60
views
Raise Package/ Class error for incompatible options
When I am writing a package or class, I sometimes have some options that are incompatible with each other. What I want is to raise an error if two such options are imported at the same time. I tried \@...
2
votes
1
answer
68
views
Produce error from macro with "incorrect" argument
I have made a macro that takes certain arguments. However, I would like it to output an error when it encounters an unexpected argument. Something like this:
MWE:
\documentclass{article}
\usepackage{...
7
votes
2
answers
3k
views
how to throw a warning in latex?
I want to know how to throw a warning when latex reach to a certain point.
For instance:
\switch [\exp1]
\case{{case 0}}
%do whatever
\case{{case 1}}
%do whatever
\otherwise
%...
59
votes
3
answers
18k
views
Is there any way to generate custom errors/warnings in LaTeX?
I want something like \ifmmode\else\GenerateWarning{The command \backslash uzuka is supported only in math mode.}\fi, which is supposed to generate a warning "The command \uzuka is supported only in ...