[OS X TeX] Error in TikZ code hard to find

Don Green Dragon fergdc at Shaw.ca
Thu Nov 13 08:53:41 CET 2014


Hello Ross,

On 11Nov2014, at 4:54 PM, Ross Moore <ross.moore at mq.edu.au> wrote:

> Hi Don,
> 
> On 12/11/2014, at 10:40 AM, Don Green Dragon wrote:
> 
>> Hello All,
>> 
>> I hope the following will not be too trivial for the knowledgeable people on this list but possibly it will help someone who regularly creates graphics with the wonderful TikZ package.
>> 
>> Was working on a document with three chapters and was revising certain parts of chapter 1, hence it was the only chapter whose source code was active.
>> 
>> Decided to include another {tikzpicture} environment. It was very simple and short and I was confident that the code would work, so typeset. TeXShop replies with an error of the form
>> 
>> .Chapters/Chapter1.tex: 5805: Undefined control sequence
>> \Generic error …
>> 					#4 \errhelp  \@err@ ...
>> 
>> l. 5805 … y over the closed interval $[0 \,..\, p]
> 
> 
> What happens if you put a set of braces around the first {tikzpicture} environment?
> 
> i.e.
> {
> \begin{tikzpicture}
>  ...
>  \path (7, 0.5) node[right[ {Picture of blah blah blah}
>  ...
> \end{tikzpicture}
> }
> 
> I'd expect that the error should now show up much earlier,
> instead of 100+ lines later.

The error was caught.  The error message on the console was

=======
./Chapters/Chapter1.tex:5006: Argument of \tikz at fig@scan at options has an extra }
.
<inserted text> 
                \par 
l.5006 }
=======

and the source code fragment was highlighted, ending at line 5006.

On removing the {…} pair, the error was NOT caught and TeXShop went to the following pair […] and declared an error with the familiar (by now) message:

========
./Chapters/Chapter1.tex:5011: Undefined control sequence.
\pgfmathsetlength ...\pgfmath at onquick #2\pgfmath@ 
                                                  {\begingroup \pgfmath at sele...
l.5011 ...[Composition of Functions is a Function]
                                                  	\label{lem1i}		% Lemma 1.9
========

and the string "[Composition of Functions is a Function]" was highlighted. I had inserted the `bad’ code immediately above the line

\begin{lem} [Composition of Functions is a Function]	\label{lem1i}

which began at line 5011 after some blank lines.

Do you normally surround a {tikxpicture} environments with { and } ?

Always helpful! Thanks.


don green dragon
fergdc at shaw.ca







More information about the macostex-archives mailing list