"Undefined Control Sequence" error for several lines

4,227

The following minimal example replicates the problem:

\documentclass{article}
\usepackage{tikz}
\usepackage{preview}

\begin{document}

This is the main text.

\end{document}

It's obviously a bad interaction (incompatibility) between tikz and preview. Either drop the loading of preview, or load it with the [active] package option.

Share:
4,227
Ali
Author by

Ali

Updated on September 09, 2020

Comments

  • Ali
    Ali about 3 years

    I get "undefined control sequence" error message for several lines: "undefined control sequence" (after "\pagebreak", where I pressed ENTER for an empty line), "undefined control sequence \section", and "undefined control sequence \end{document}".

    It is the first time that I installed TeXstudio on Windows 7. I also installed MiKTeX prior to TeXstudio. Moreover, I tried the code on Windows XP and didn't get the error messages at all.

    The complete code is below.

    \documentclass[a4paper]{article}
    \usepackage{graphicx,float}
    \floatstyle{boxed}
    \usepackage[toc,page]{appendix}
    \usepackage{hyperref}
    \usepackage{amssymb}
    \usepackage{amsmath}
    \usepackage{textcomp}
    \usepackage{multirow}
    \usepackage{natbib}
    \usepackage{tikz}
    \usetikzlibrary{decorations.pathreplacing}
    \usetikzlibrary{decorations.pathmorphing, patterns,shapes}
    \usepackage{preview}
    \usepackage[affil-it]{authblk}
    \usepackage{amsthm}
    \newtheorem{proposition}{Proposition}
    \newtheorem{lemma}{Lemma}
    
    
    \title{the title}
    \begin{document}
    \date{March 4, 2014}
    \maketitle
    \pagebreak
    
    hi
    
    \section{Intro}
    
    This is the main text.
    
    \end{document}
    
    • Werner
      Werner over 9 years
      Drop the use of \usepackage{preview}...
    • Admin
      Admin over 9 years
      Your document compiles without any complains from LaTeX under TexLive 2013 (Linux)
    • Jeroen Zuiddam
      Jeroen Zuiddam over 9 years
      What is the first error? Are you sure that you are running pdfLaTeX and not pdfTeX?
    • Jeroen Zuiddam
      Jeroen Zuiddam over 9 years
      @Werner Does anyone know why preview is causing problems here?