0

I have a document at hand that was written by using an old template and now I want to copy it to a new one. However, when I do this and execute the code I am facing the error

Missing $ inserted.

for all inline math modes. That's because in my initial template I used the symbol \( \) to write all the inline math equations and somehow my new template does not accept this notation but forces me to use $ instead. So, my question is: What should I do to define the equality $...$ = \(...\) or how can I interchange these two?

  • 2
    For me \( and \) are working, no matter what I try. Please provide MWE, so we can figure out, where the problem is. – Wamseln Oct 18 '15 at 18:55
  • 1
    Sorry for being silent so long, I was trying to put my template into ShareLaTeX which I finally managed. Here it is: sharelatex.com/project/5623f19368d179c93909d251 – sahin Oct 18 '15 at 19:26
  • 2
    Ok, so the problem is certainly caused by \def\({\left(} and \def\){\right)}. I think you should change those in order to get back the usual \( and \) behaviour. – Wamseln Oct 18 '15 at 19:32
  • 3
    It is definitely not a good template. It is using obsolete and deprecated packages. It is loading things in the wrong order. It is loading things multiple times. It is setting manually what would be better managed by a package designed for the purpose. And it redefines the standard markup for inline maths mode!! At the very least, delete lines 59 and 60. Better, don't use it at all. – cfr Oct 18 '15 at 19:32
  • 2
    Also, eqnarray shouldn't be used. Use align from amsmath instead. – Bernard Oct 18 '15 at 19:39
5

Here's an attempt to clean things up a bit. More could be done, but I think this modifies the worst features of the original template.

\documentclass[12pt,letterpaper]{article}
\usepackage{mathtools,amssymb}
\usepackage{graphicx,xcolor}
\usepackage{verbatim}
\usepackage{fancybox}
\usepackage{ulem}
\usepackage{enumitem}
% \usepackage{subfigure}% obsolete! use subfig or, better, subcaption
\usepackage{bbm}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\newlength\normalparindent
\setlength\normalparindent\parindent
\usepackage{parskip,setspace}
\setstretch{1.3}
\usepackage[textwidth = 6.5in, textheight = 8.5in, marginparwidth=0pt, marginparsep=0pt, headheight=0pt, headsep=0pt, left=1in, top=1.2in]{geometry}
\usepackage{titling}

\newcommand{\Comment}[1]{{}}
\definecolor{MyDarkBlue}{rgb}{0.15,0.15,0.45}
\usepackage[linktocpage=true]{hyperref}
\hypersetup{
  colorlinks=true,
  citecolor=MyDarkBlue,
  linkcolor=MyDarkBlue,
  urlcolor=MyDarkBlue,
  pdfauthor={John Smith},
  pdftitle={SUBJECT},
  pdfsubject={hep-th}
}

% use align rather than eqnarray
\newcommand{\nn}{\nonumber}

\newcommand{\gmu}{\gamma^\mu}
\newcommand{\gnu}{\gamma^\nu}
\newcommand{\glmu}{\gamma_\mu}
\newcommand{\gf}{\gamma^5}
\newcommand{\Tr}{\text{Tr}}
\newcommand{\qb}{\mathbf{q}}
\newcommand{\pb}{\mathbf{p}}
\newcommand{\kb}{\mathbf{k}}
\newcommand{\xb}{\mathbf{x}}
\newcommand{\pd}{(2\pi)^d}
\newcommand{\intx}{\int d^d \mathbf{x}\ }

\newcommand{\la}{\langle}
\newcommand{\ra}{\rangle}
\newcommand{\lb}{\left[}
\newcommand{\rb}{\right]}
\newcommand{\half}{\frac{1}{2}}
\newcommand{\pf}{(2\pi)^4}
\newcommand{\intkd}{\int \frac{d^Dk}{(2\pi)^D}\ }
\newcommand{\intpd}{\int \frac{d^Dp}{(2\pi)^D}\ }
\newcommand{\intpdo}{\int \frac{d^{D-1}k}{(2\pi)^{D-1}}\ }
\newcommand{\intl}{\int \frac{d^4l}{(2\pi)^4}\ }
\newcommand{\intld}{\int \frac{d^dl}{(2\pi)^d}\ }
\newcommand{\intle}{\int \frac{d^4l_E}{(2\pi)^4}\ }
\newcommand{\intp}{\int d^d \mathbf{p}\ }
\newcommand{\wsp}{\omega_{\mathbf{p}}}
\newcommand{\intpp}{\int \frac{d^d \mathbf{p}}{\sqrt{\pd 2\wsp}}\ }

\title{SUBJECT\thanks{This is a title.}}
\author{John Smith\textsuperscript{\itshape a,}\thanks{E-mail address: \Comment{\href{mail@mail.edu}}{\url{mail@mail.edu}}}}
\date{}
\pretitle{\begin{center}\LARGE\bfseries}% Note that your original settings do not get bold small-caps and would not do so even if this shape existed in bold for this font. If you want small-caps, change \bfseries to \scshape
\posttitle{\par\end{center}\vskip 10mm}
\preauthor{\begin{center}\large\scshape}
\postauthor{\par\end{center}\vskip 10mm}
\predate{}
\postdate{}
\renewcommand\maketitlehookc{\begin{center}\itshape\textsuperscript{a}Department,\par Address\par\end{center}\vskip 10mm}

\numberwithin{equation}{section}

\begin{document}
\setlength\parindent\normalparindent% Not at all clear this is wise with skip between paragraphs as well, but if you must, you must...
\maketitle\thispagestyle{empty}

\begin{abstract}
Abstract goes in here.
\end{abstract}
\clearpage

\tableofcontents
\clearpage

\section{Introduction}

\section{Conclusions}

\section{Acknowledgements}

\appendix

\section{Appendix 1}

\addcontentsline{toc}{section}{References}
\input{references.tex}

\end{document}

Modified template

| improve this answer | |
  • \be,\ee etc. with align wont work, see What is wrong with defining \bal as \begin{align}? – Torbjørn T. Oct 18 '15 at 20:57
  • @TorbjørnT. Thanks! I forgot about Bernard's comment until I'd pasted the code and didn't check it out properly. Thanks for pointing that out, and for the link. (I'm sure I've read that before but had forgotten.) – cfr Oct 18 '15 at 21:13

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.