I'm creating a document in LaTeX with the bibliography in a separated BibTeX file.

When I compile the document without any reference to the bibliography it runs correctly, but when I add references to the bibliography it sends the following error.

! You can't use `the character 1' after \the.

I was making some tests and when I remove the tikzpicture, the whole file compiles correctly, including the bibliography. But when I add the picture again, I get the same error.

The following code is a sample with the image that triggers the error.

%Si se activa no funcionan algunos gráficos



\usepackage[left=2cm,right=2cm, top=2.5cm, bottom=2.5cm]{geometry}

\setcounter{secnumdepth}{3} %para que ponga en subsubsecciones
\setcounter{tocdepth}{3} % para que ponga subsubsecciones en el indice


\graphicspath{ {imagenes/} }

{\chapter} % command
[display] % shape
{\bfseries\Large\itshape} % format
%{Story No. \ \thechapter} % label
{0.5ex} % sep
} % before-code
] % after-code



\title{Apuntes y Tareas de Probabilidad.}
\author{Luis Alejandro Barranco Ju\'arez}


%\textsc{Apuntes y Tareas.}


\tableofcontents % indice de contenidos



\chapter{Tarea 1} 
\markboth{TAREA 1}{TAREA 1}

\section{Tri\'angulos de Pascal.}   

    % some colors
    % some styles
            minimum height=5mm,
            inner sep=.7mm,
            outer sep=0mm,
            text width=10mm,
            text centered,
            line width=.25mm,
            top color=#1!5,
            bottom color=#1!40,
            shading angle=0,
            rounded corners=2.3mm,
            drop shadow={fill=#1!40!gray,fill opacity=.8},
            link/.style={-latex,links,line width=.3mm},
    % Pascal's triangle
    % row #0 => value is 1
    \node[box=odd] (p-0-0) at (0,0) {1};
    \foreach \row in {1,...,16} {
     % col #0 => value is 1
            \node[box=odd] (p-\row-0) at (-\row/2,-\row) {1};
            \foreach \col in {1,...,\row} {
        % iterative formula : val = precval * (row-col+1)/col
        % (+ 0.5 to bypass rounding errors)
            % position of each value
            \coordinate (pos) at (-\row/2+\col,-\row);
            % odd color for odd value and even color for even value
            \ifnum \rest=0
                    \node[box=even] (p-\row-\col) at (pos) {\value};
                    \node[box=odd] (p-\row-\col) at (pos) {\value};
      % for arrows and plus sign
%      \ifnum \col<\row
%        \node[plus,above=0mm of p-\row-\col]{+};
%        \pgfmathtruncatemacro{\prow}{\row-1}
%        \pgfmathtruncatemacro{\pcol}{\col-1}
%        \draw[link] (p-\prow-\pcol) -- (p-\row-\col);
%        \draw[link] ( p-\prow-\col) -- (p-\row-\col);
%      \fi
            % filling and drawing with the same color to enlarge background
            \path[draw=back,fill=back,line width=5mm,rounded corners=2.5mm]
            (  p-0-0.north west) -- (  p-0-0.north east) --
            (p-16-16.north east) -- (p-16-16.south east) --
            ( p-16-0.south west) -- ( p-16-0.north west) --

    Para n=5.


\bibliographystyle{acm} % estilo de la bibliografía.
\bibliography{prueba} % biblio.bib es el fichero donde está salvada la bibliografía.


My .bib file looks like this:

author    = "G.Polya",
title     = "How to Solve It",
publisher = "Princeton University Press",
year      = "1957",

What is causing this problem?

  • 2
    Please make your code snippet compilable! Then we can copy your code and test on our own computers ... Welcome to TeX.SE! – Mensch Jun 15 '16 at 21:32
  • Thank you, I have modified the post with a sample of my code with the elements that are not compiling correctly. – labj86 Jun 15 '16 at 21:58
  • Thank you, I have run the code for the tikz picture and it works fine, but when I add the link to the bibliography, the file doesn't compile. – labj86 Jun 15 '16 at 23:10
  • 1
    Have you checked the log files for warnings? If there are warnings check all of them! They can cause/explain the problem. Add the tikz code only if it is error and warning free ... – Mensch Jun 15 '16 at 23:14
  • Please consider minimising your code. If you have a really simple picture, does the problem still occur? Does it go away if you don't load cancel? If not, you don't need cancel in the example. You should also consider cleaning up your preamble for your own sake. You have a lot of redundant stuff there which will only make troubleshooting harder. – cfr Jun 15 '16 at 23:58

Thoughtless use of \def, \let, \global etc. costs lives.

Well, they waste time, anyway, and if you waste enough of that, that's a life gone.

You have overridden TeX's definition of \value and made this redefinition global by saying


TeX is, therefore, unable to do anything which depends on \value after this point in the document. The citation is just collateral damage.

Here's a not minimal, but at least more minimal, example which reproduces the error:

\ifnum\value{page}=1 hi\else bye\fi

  \foreach \row in {1,...,16} {
    \foreach \col in {1,...,\row} {

\ifnum\value{page}=1 hi\else bye\fi

The problem can be addressed by ensuring that new macro names do not overwrite existing ones. In this case, substituting \myvalue for \value will work.

Using \newcommand*\value{1} rather than \pgfmathsetmacro{\value}{1} would have provided an informative error message explaining the problem.

|improve this answer|||||
  • Thank you very much, this helped me to solve the problem. – labj86 Jun 17 '16 at 19:26
  • @labj86 Croeso! (You're welcome!) – cfr Jun 17 '16 at 20:54

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.