1

Good morning. I've installed the latest miktex package on a new computer with fresh windows 10 copy. I need use some latex documents to rewrite code but with this LaTeX code I get "missing $ inserted" error:

...
declarations
...
\definecolor{verdpxo}{rgb}{.6,1,.4}     % Verd pistatxo
\definecolor{grocpastel}{rgb}{1,1,.4}   % Groc pastel

\pagestyle{myheadings} \markboth{\underline{\copyright\ Lloren\c{c} Sastre\hspace{13cm}p\`agina\ }}
{\underline{\copyright\  Lloren\c{c} Sastre\hspace{13cm}p\`agina\ }}

\begin{document}

%\include{accents}
%\noindent\epsfig{file=logodist.eps, height=25mm}\hspace{1cm}
%{\Large \sl Matem\`atiques. 1r BTX CCSS \ \ \hfill Curs 2007-08}
\noindent
\begin{tabular}{|>{\columncolor{verdpxo}}m{1mm} m{25mm}|m{90mm}|m{10mm}|c|}
  \hline
  % after \\: \hline or \cline{col1-col2} \cline{col3-col4} ...
  % color rgb: >{\columncolor[rgb]{.9,.9,.9}}
  \vspace{0.2 mm}\hphantom{I} \vspace{0.2 mm} &
  \multicolumn{3}{>{\columncolor{verdpxo}}c|}{Model d'examen d'exercicis} &
  \multirow{3}{*}{\epsfig{file=logodist.eps, width=20mm}} \\ \cline{1-4}
  \vspace{0.2 mm}\hphantom{I} \vspace{0.2 mm} &
  \multicolumn{1}{>{\columncolor{verdpxo}}l|}{Departament} & \multicolumn{2}{l|}{Matemàtiques} & \\ \cline{1-4}
  \vspace{0.2 mm}\hphantom{I} \vspace{0.2 mm} &
  \multicolumn{1}{>{\columncolor{verdpxo}}l|}{Matèria} & \multicolumn{2}{l|}{Primera i Segona avaluació} & \\ \hline
  \vspace{0.2 mm}\hphantom{I} \vspace{0.2 mm} &
  \multicolumn{1}{>{\columncolor{verdpxo}}l|}{Professor} & \multicolumn{1}{l|}{Llorenç Sastre} & \multicolumn{1}{|>{\columncolor{verdpxo}}l|}{Curs} &  \multicolumn{1}{l|}{1r BTX CCSS} \\ \hline
  \vspace{0.2 mm}\hphantom{I} \vspace{0.2 mm} &
  \multicolumn{1}{>{\columncolor{verdpxo}}l|}{Data} & \multicolumn{1}{l|}{} & \multicolumn{1}{|>{\columncolor{verdpxo}}l|}{Nota} &   \\ \cline{1-3}
  \vspace{0.2 mm}\hphantom{I} \vspace{0.2 mm} &
  \multicolumn{1}{>{\columncolor{verdpxo}}l|}{Nom alumne} &  & \multicolumn{1}{|>{\columncolor{verdpxo}}l|}{} &  \\
  \hline
\end{tabular}
...
more code
...

When compile with pdflatex I get this error:
Missing $ inserted.
<inserted text> 
                $
l.99 ...column{2}{l|}{Primera i Segona avaluació}
                                                   & \\ \hline

I'm unable to find where this error is. This code works fine with a previous installation of miktex on a windows 7 computer. May someone help me?

3
  • 1
    Welcome to TeX.SE. Have you used \usepackage[T1]{\fontenc}? I not see the complete your code as the missing logodist.eps.
    – Sebastiano
    May 4, 2020 at 10:23
  • Yes, in my preamble I was used \usepackage[T1]{fontenc} and \usepackage[latin1]{inputenc} (sorry for not write complete preamble). My document was saved in utf-8 format. I've edited with notepad and saved it in ANSI format and then it has worked fine, but text was not centered vertically. I think the problem was "ó" character (and others characters too but "ó" caused the problem) with [latin1] and utf-8 format of file. They are not compatible. May 4, 2020 at 16:15
  • Don't worry absolutely almost with me :-) but it is very important if you could to put the minimal complete code deleting the picture (I think that it is not the problem). Also I have thinked that the problem was "ó" character :-). But you have a very nice answer of @Zarko as expert in tables.
    – Sebastiano
    May 4, 2020 at 16:21

1 Answer 1

2

You provide only code fragment of your table, so we haven't any clue, what is in preamble of your document. Testing it in some mine MWE (Minimal Working Example) shows, that you have problem with

\epsfig{file=logodist.eps, width=20mm}

If it is replaced with

\includegraphics[width=20mm]{example-image-duck}}

where example-image-duck is test image provided by graphicx package, than table compile fine. However, table code is, frankly said, is unnecessary complicated. After clean-up all clutter in code, the MWE is:

\documentclass{article}
\usepackage{geometry}
\usepackage[table]{xcolor}
\definecolor{verdpxo}{rgb}{.6,1,.4}     % Verd pistatxo
\definecolor{grocpastel}{rgb}{1,1,.4}   % Groc pastel
\usepackage{array, multirow}
\usepackage{graphicx}
\newcommand\mcc[1]{\multicolumn{2}{c|}{#1}}
\newcommand\mcl[1]{\multicolumn{2}{l|}{#1}}

\begin{document}
\begin{center}
\renewcommand\arraystretch{1.5}
\begin{tabular}{ |>{\columncolor{verdpxo}}m{25mm}| m{70mm}| c | c | }
    \hline
            &   \mcc{\cellcolor{verdpxo}{Model d'examen d'exercicis}}
                &   \multirow{3}{*}{%
                    \includegraphics[width=20mm]{example-image-duck}}\\ \cline{1-3}
Departament &   \mcl{Matemàtiques}                  &               \\  \cline{1-3}
Matèria     &   \mcl{Primera i Segona avaluació}    &               \\  \hline
Professor   &   Llorenç Sastre            
                &   \cellcolor{verdpxo}{Curs}       &  1r BTX CCSS  \\  \hline
Data        &   &   \cellcolor{verdpxo}{Nota}       &               \\  \cline{1-2}
Nom alumne  &   &   \cellcolor{verdpxo}{}           &               \\
    \hline
\end{tabular}
\end{center}
\end{document}

enter image description here

In your document you should replace example-image-duck with logodist (without file extension .eps)

2
  • Thanks a lot!!! Yes, in my preamble I was used \usepackage[T1]{fontenc} and \usepackage[latin1]{inputenc} (sorry for not write complete preamble). My document was saved in utf-8 format. I've edited with notepad and saved it in ANSI format and then it has worked fine, but text was not centered vertically (your code it is!). The problem was "ó" character with [latin1] and utf-8 format of file. They are not compatible. Now I'll use your code, it is better than mine! Regards, Llorenç May 4, 2020 at 16:08
  • @LLORENÇSASTREMORAGUES, utf8 is default encoding in recent version of the article document class. And you are right, utf8 is not compatible with latin1. BTW, if answer solve your problem, you can accept it (by clicking on check mark at top left side of answer.
    – Zarko
    May 4, 2020 at 17:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .