Graphics, Figures & TablesErrors with matrix environment

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
di remigio
Posts: 4
Joined: Tue Sep 08, 2009 7:22 pm

Errors with matrix environment

Post by di remigio »

I am writing my thesis with the classicthesis style, I compile using pdflatex
in TeX Live 2010.
I run into the following error:
Package array Error: Empty preamble: `l' used.

The error is generated by the code:

Code: Select all

\begin{equation*}
g_{\mu\nu}=
\begin{pmatrix}
   1 & 0 & 0 & 0 \\
   0 & -1 & 0 & 0 \\
   0 & 0 & -1 & 0 \\
   0 & 0 & 0 & -1
 \end{pmatrix}
\end{equation*}
which seems to me alright.

I can't understand what the error means. Classicthesis loads amsmath by default,
then I load also the mathtools package. After some trials it seems that neither is
the source for this error.

Also, when compiling using TeX Live 2011 the error does not appear.
Does anybody have any idea?
Thanks.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
Stefan Kottwitz
Site Admin
Posts: 10358
Joined: Mon Mar 10, 2008 9:44 pm

Errors with matrix environment

Post by Stefan Kottwitz »

Hi,

the error is not generated by this code. Test this compilable example to see it:

Code: Select all

\documentclass{scrbook}
\usepackage{classicthesis}
\usepackage{amsmath}
\begin{document}
\begin{equation*}
g_{\mu\nu}=
\begin{pmatrix}
   1 & 0 & 0 & 0 \\
   0 & -1 & 0 & 0 \\
   0 & 0 & -1 & 0 \\
   0 & 0 & 0 & -1
\end{pmatrix}
\end{equation*}
\end{document}
Please post code which causes this error. Just a code snippet which cannot be compilable is often not helpful. That's the case here, the error is caused somewhere else.

Stefan
LaTeX.org admin
di remigio
Posts: 4
Joined: Tue Sep 08, 2009 7:22 pm

Errors with matrix environment

Post by di remigio »

The situation it's a bit complicated. I'm loading the packages through the
classicthesis-config.tex file, provided with the style file, adding the packages I need.
That file is loaded with \input{} after the \documentclass call.
This is the whole file:

Code: Select all

\PassOptionsToPackage{floatperchapter,pdfspacing,subfig,parts,drafting,
                      beramono
                       %eulerchapternumbers,drafting,listings,
		       %linedheaders,%listings,eulermath,
                      }{classicthesis}										
\usepackage{ifthen}
\newboolean{enable-backrefs} % enable backrefs in the bibliography
\setboolean{enable-backrefs}{false} % true false
\newcommand{\myTitle}{TITLEl\xspace}
\newcommand{\mySubtitle}{SUBTITLE\xspace}
\newcommand{\myDegree}{DEGREE\xspace}
\newcommand{\myName}{NAME\xspace}
\newcommand{\myProf}{PROF1\xspace}
\newcommand{\myOtherProf}{PROF2\xspace}
\newcommand{\mySupervisor}{Put name here\xspace}
\newcommand{\myFaculty}{FACULTY\xspace}
\newcommand{\myDepartment}{DEP\xspace}
\newcommand{\myUni}{\protect{UNI}\xspace}
\newcommand{\myLocation}{LOC\xspace}
\newcommand{\myTime}{June 2011\xspace}
\newcommand{\myAA}{Anno Accademico 2011/2012\xspace}
\newcommand{\myVersion}{version 4.0\xspace}

\newcounter{dummy} % necessary for correct hyperlinks (to index, bib, etc.)
\newlength{\abcd} % for ab..z string length calculation
\providecommand{\mLyX}{L\kern-.1667em\lower.25em\hbox{Y}\kern-.125emX\@}
\newcommand{\ie}{i.\,e.}
\newcommand{\Ie}{I.\,e.}
\newcommand{\eg}{e.\,g.}
\newcommand{\Eg}{E.\,g.} 
\PassOptionsToPackage{utf8x}{inputenc}		% utf8x
 \RequirePackage{inputenc}				% NB: LyX likes to set inputenc too, let's avoid clashes

\PassOptionsToPackage{american,italian}{babel}   % change this to your language(s)
 \usepackage{babel}					

\PassOptionsToPackage{round,sort&compress}{natbib}
 \RequirePackage{natbib}				% NB: LyX likes to set natbib too, let's avoid clashes

\PassOptionsToPackage{fleqn}{amsmath}		% math environments and more by the AMS 
 \RequirePackage{amsmath}

\PassOptionsToPackage{T1}{fontenc} % T2A for cyrillics
	\usepackage{fontenc}                 
\usepackage{xspace} % to get the spacing after macros right  
\usepackage{mparhack} % get marginpar right
\usepackage{fixltx2e} % fixes some LaTeX stuff 
\PassOptionsToPackage{printonlyused,smaller}{acronym}
	\usepackage{acronym} % nice macros for handling all acronyms in the thesis
%\renewcommand*{\acsfont}[1]{\textssc{#1}} % for MinionPro
\renewcommand{\bflabel}[1]{{#1}\hfill} % fix the list of acronyms
\usepackage{tabularx} % better tables
	\setlength{\extrarowheight}{3pt} % increase table row height
\newcommand{\tableheadline}[1]{\multicolumn{1}{c}{\spacedlowsmallcaps{#1}}}
\newcommand{\myfloatalign}{\centering} % to be used with each float for alignment
\usepackage{caption}
\captionsetup{format=hang,font=small}
\usepackage{subfig}  
\usepackage{listings} 
\lstset{language=[LaTeX]Tex,%C++,
    keywordstyle=\color{RoyalBlue},%\bfseries,
    basicstyle=\small\ttfamily,
    %identifierstyle=\color{NavyBlue},
    commentstyle=\color{Green}\ttfamily,
    stringstyle=\rmfamily,
    numbers=none,%left,%
    numberstyle=\scriptsize,%\tiny
    stepnumber=5,
    numbersep=8pt,
    showstringspaces=false,
    breaklines=true,
    frameround=ftff,
    frame=single,
    belowcaptionskip=.75\baselineskip
    %frame=L
} 
\PassOptionsToPackage{pdftex,hyperfootnotes=false,pdfpagelabels}{hyperref}
	\usepackage{hyperref}  % backref linktocpage pagebackref
\pdfcompresslevel=9
\pdfadjustspacing=1 
\PassOptionsToPackage{pdftex}{graphicx}
	\usepackage{graphicx} 

\newcommand{\backrefnotcitedstring}{\relax}%(Not cited.)
\newcommand{\backrefcitedsinglestring}[1]{(Cited on page~#1.)}
\newcommand{\backrefcitedmultistring}[1]{(Cited on pages~#1.)}
\ifthenelse{\boolean{enable-backrefs}}%
{%
		\PassOptionsToPackage{hyperpageref}{backref}
		\usepackage{backref} % to be loaded after hyperref package 
		   \renewcommand{\backreftwosep}{ and~} % separate 2 pages
		   \renewcommand{\backreflastsep}{, and~} % separate last of longer list
		   \renewcommand*{\backref}[1]{}  % disable standard
		   \renewcommand*{\backrefalt}[4]{% detailed backref
		      \ifcase #1 %
		         \backrefnotcitedstring%
		      \or%
		         \backrefcitedsinglestring{#2}%
		      \else%
		         \backrefcitedmultistring{#2}%
		      \fi}%
}{\relax}    

\hypersetup{%
    %draft,	% = no hyperlinking at all (useful in b/w printouts)
    colorlinks=true, linktocpage=true, pdfstartpage=3, pdfstartview=FitV,%
    % uncomment the following line if you want to have black links (e.g., for printing)
    %colorlinks=false, linktocpage=false, pdfborder={0 0 0}, pdfstartpage=3, pdfstartview=FitV,% 
    breaklinks=true, pdfpagemode=UseNone, pageanchor=true, pdfpagemode=UseOutlines,%
    plainpages=false, bookmarksnumbered, bookmarksopen=true, bookmarksopenlevel=1,%
    hypertexnames=true, pdfhighlight=/O,%nesting=true,%frenchlinks,%
    urlcolor=webbrown, linkcolor=RoyalBlue, citecolor=webgreen, %pagecolor=RoyalBlue,%
    %urlcolor=Black, linkcolor=Black, citecolor=Black, %pagecolor=Black,%
    pdftitle={\myTitle},%
    pdfauthor={\textcopyright\ \myName, \myUni, \myFaculty},%
    pdfsubject={},%
    pdfkeywords={},%
    pdfcreator={pdfLaTeX},%
    pdfproducer={LaTeX with hyperref and classicthesis}%
}   

\makeatletter
\@ifpackageloaded{babel}%
    {%
       \addto\extrasamerican{%
					\renewcommand*{\figureautorefname}{Figure}%
					\renewcommand*{\tableautorefname}{Table}%
					\renewcommand*{\partautorefname}{Part}%
					\renewcommand*{\chapterautorefname}{Chapter}%
					\renewcommand*{\sectionautorefname}{Section}%
					\renewcommand*{\subsectionautorefname}{Section}%
					\renewcommand*{\subsubsectionautorefname}{Section}% 	
				}%
       \addto\extrasngerman{% 
					\renewcommand*{\paragraphautorefname}{Absatz}%
					\renewcommand*{\subparagraphautorefname}{Unterabsatz}%
					\renewcommand*{\footnoteautorefname}{Fu\"snote}%
					\renewcommand*{\FancyVerbLineautorefname}{Zeile}%
					\renewcommand*{\theoremautorefname}{Theorem}%
					\renewcommand*{\appendixautorefname}{Anhang}%
					\renewcommand*{\equationautorefname}{Gleichung}%        
					\renewcommand*{\itemautorefname}{Punkt}%
				}%	
			% Fix to getting autorefs for subfigures right (thanks to Belinda Vogt for changing the definition)
			\providecommand{\subfigureautorefname}{\figureautorefname}%  			
    }{\relax}
\makeatother


\usepackage{classicthesis} 
\graphicspath{{gfx/}}
\usepackage{eso-pic}
\usepackage{wrapfig}
\usepackage{booktabs}
\usepackage{paralist}
\usepackage{verbatim}
\usepackage{mathrsfs}
\usepackage{amstext}
\usepackage{amscd}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{mathtools}
\usepackage{tensor}
\usepackage{wasysym}
\usepackage{simplewick}
\usepackage{epigraph}

\newtheoremstyle{classicdef}% Nome
{12pt}% Spazio che precede l’enunciato
{12pt}% Spazio che segue l’enunciato
{}% Stile del font dell’enunciato
{}% Rientro (se vuoto, non c’è rientro,
% \parindent = rientro dei capoversi)
{\scshape}% Stile del font dell’intestazione
{:}% Punteggiatura che segue l’intestazione
{.5em}% Spazio che segue l’intestazione:
% " " = normale spazio inter-parola;
% \newline = a capo
{}% Specifica l’intestazione dell’enunciato
% (normalmente viene lasciata vuota)

\newtheoremstyle{classicthm}% Nome
{12pt}% Spazio che precede l’enunciato
{12pt}% Spazio che segue l’enunciato
{\itshape}% Stile del font dell’enunciato
{}% Rientro (se vuoto, non c’è rientro,
% \parindent = rientro dei capoversi)
{\scshape}% Stile del font dell’intestazione
{:}% Punteggiatura che segue l’intestazione
{.5em}% Spazio che segue l’intestazione:
% " " = normale spazio inter-parola;
% \newline = a capo
{}% Specifica l’intestazione dell’enunciato
% (normalmente viene lasciata vuota)


\theoremstyle{classicthm}
\newtheorem{theorem}{Theorem}
\newtheorem{lemma}{Lemma}
\newtheorem{proposition}{Proposition}
\newtheorem*{corollary}{Corollary}

\theoremstyle{classicdef}
\newtheorem{defin}{Definition}
\newtheorem{conjecture}{Conjecture}
\newtheorem{example}{Example}

\theoremstyle{remark}
\newtheorem*{rem}{Remark}
\newtheorem*{note}{Note}
\newtheorem{case}{Case}

\newenvironment{Proof}{\vspace*{1.5pt}\begin{proof}\small{}}{\end{proof}\vspace*{1.5pt}}
\renewenvironment{example}[1][]{\subparagraph*{Example} #1 \small{}}{}

\usepackage{time}
\usepackage{textcomp}
\usepackage{xcolor}
\usepackage{indentfirst}
\usepackage[bottom]{footmisc}
\usepackage{epigraph}
\renewcommand{\textflush}{flushright}
\renewcommand{\theenumi}{\roman{enumi}.}
\renewcommand{\labelenumi}{\theenumi}
\renewcommand{\epsilon}{\varepsilon}
%\usepackage{refcheck}
%\usepackage{showkeys}

%%% Simboli
\allowdisplaybreaks
\newcommand{\Degree}{\ensuremath{^\circ}}
% Definizione comandi per differenziale e derivata parziale
\newcommand*{\diff}{\mathop{}\!\mathrm{d}}
\newcommand*{\Supp}{\mathop{}\!\mathrm{Supp}}

\newcommand*{\deriv}[3][]{% 
\frac{\diff^{#1}#2}{\diff #3^{#1}}} 
\newcommand*{\pderiv}[3][]{% 
\frac{\partial^{#1}#2}% 
{\partial #3^{#1}}}

\newcommand*{\tr}{\mathrm{tr}}% Traccia
\newcommand*{\crea}[1]{{#1}^{\dagger}}% Creatori
\newcommand*{\distr}[1]{{#1}}% Distruttori
\newcommand*{\normale}[1]{:#1:}% Ordinamento normale
\newcommand*{\id}{\mathop{}\!\mathitbf{id}}% Identit\`a 
\newcommand{\ubar}[1]{\underbar{\ensuremath{#1}}}
\newcommand*{\ketv}{|\mathrm{vac}\rangle}% Vacuum Ket
\newcommand*{\brav}{\langle\mathrm{vac}|}% Vacuum Bra
\newcommand{\anticomm}[2]{\lbrace #1, #2 \rbrace}% Anticommutatore!!

\newcommand{\hilop}[1]{\mathcal{#1}}
\newcommand{\basop}[1]{\mathitbf{#1}}
\newcommand*{\vett}[1]{\mathbf{#1}}
\newcommand*{\opve}[1]{\hat{\boldsymbol{#1}}}
\newcommand*{\vers}[1]{\hat{\mathbf{u}}_{#1}}
\newcommand*{\vcomp}[2]{{#1}_{#2}}
\newcommand*{\levi}{\varepsilon_{ijk}}
\newcommand*{\civita}[3]{\varepsilon_{#1 #2 #3}}
\newcommand*{\supp}[1]{\mathrm{Supp}(#1)}

\numberwithin{equation}{section}
\renewcommand{\qedsymbol}{\Large{\smiley}}

%\renewcommand{\epigraphflush}{flushleft}
\renewcommand{\epigraphwidth}{.7\textwidth}
%\renewcommand{\sourceflush}{flushleft}
I included too much for sure.
Post Reply