A couple weeks ago, this tikzpicture is produced nicely so I assume I have no problem anymore with it and get into the writting part. But when I checked the picture a couple days ago, the picture become look like this: enter image description here

I assume the error is on the \if, but when I try to reproduce it on a new tex project using the same custom class, the tikz picture is drawn nicely.

There are so many addition after that, so I don't know the reason why I can face this strange behaviour. Could somebody help me find the problem?

This is the code:

\begin{adjustbox}{max width=\textwidth}
    neuron/.style={shape=circle, minimum size=1.25cm, inner sep=0, draw, font=\small},
    rct/.style={draw, font=\small, inner sep=0, minimum size=1.25cm, shape=rectangle},
    ttk/.style={draw=none, scale=2},
\begin{tikzpicture}[x=2.2cm, y=1.5cm, >=Stealth]
  \foreach \t [count=\ti, evaluate={\ta=int(\ti-1);}] in {-1, 1, 2, 3, \ldots, T, -1}{
        \node [ttk] at (\ti,1) (h-\ti) {\ldots};
        \node [ttk] at (\ti, 1) (h-\ti) {};
          \node [ttk] at (\ti, 1) (h-\ti) {};
            \node [rct] at (\ti,1) (h-\ti){$\mathbf h_{\t}$};
            \node [rct, below=of h-\ti] (x-\t) {$\mathbf x_{\t}$};
            \node [rct, above=of h-\ti] (y-\t) {$\mathbf y_{\t}$};
            \draw [->] (x-\t) -- (h-\ti);
          \draw [->] (h-\ti) -- (y-\t);
      \draw [->] (h-\ta.east) -- (h-\ti.west);
\caption{Some caption}

This is the reproduced picture (and was the picture before the problem arise): enter image description here


I just found the cause of this strange behavior, and can resolve my problem. But I still open this question for the explanation why such thing can make the tikz picture have a strange behavior.

This is the main cause: I put this on my tex


and the definition on the class is:


where the use of that command is on this part of class:

  \MakeUppercase{\normalfont\large\bfseries\expandafter{Halaman Pengesahan}}\\
Telah dipersiapkan dan disusun oleh\\
Telah dipertahankan di depan Tim Penguji\\
pada tanggal \expandafter{\@examdate}\\
Susunan Tim Penguji\\
Pembimbing&Ketua Penguji

&Anggota Penguji

\addcontentsline{toc}{chapter}{Halaman Pengesahan}

when I change the \ldots to a real character on

\firstexaminer{John Doe}

The \if inside tikzpicture is working like a charm.

this is the class file: https://github.com/muhrifqii/skripsi-fmipa-ugm-latex/blob/master/ugmskripsi.cls

  • 2
    if you want help with an error please always post a test file that reproduces the error so people can debug it. Disconnected fragments are much harder to debug and force anyone helping to try to guess how you used those fragments in a document – David Carlisle May 8 '17 at 6:52
  • thanks @DavidCarlisle , I have edited the question for the class file – Muhammad Rifqi Fatchurrahman May 8 '17 at 8:14

expands \t and then tests the charter codes of the first two characters

so if \t was aa it would be true, if \t was ab it would be false. If \t has just one character then it would be tested against the = so just true if it is =. If \t is empty then the test will test if the frirst character in the expansion of \ldots is =.

Probably you want


where \zldots is defined by


Here is a much easier way of doing this:


  \begin{tikzpicture}[rct/.style={draw, font=\small, inner sep=0, minimum size=8mm, shape=rectangle},
    \foreach \row[count=\y] in {x, h, y} {
       \foreach \x/\sub in {1/1, 2/2, 3/3, 5/T} {
           \node[rct](\row\x) at (\x,\y) {$\row_{\sub}$};
    \foreach \x in {1,2,3,5} {
        \draw[->] (x\x) -- (h\x);
        \draw[->] (h\x) -- (y\x);
    \coordinate (h0) at (0,2);
    \coordinate (h6) at (6,2);
    \node[shape=rectangle, inner sep=0, minimum size=8mm] (h4) at (4,2) {$\cdots$};
    \foreach \x [evaluate=\x as \xx using int(\x+1)] in {0, ..., 5} {
        \draw[->] (h\x) -- (h\xx);


As above, this produces:

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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