0

How would you implement the "catcode" solution here for superscripts? Thanks

EDIT

The code below reproduces the error (complied using XeLaTeX). Works if the following two lines are commented out:

\catcode`^=\active
\newcommand^[1]{\ensuremath{\sp{\scriptscriptstyle #1}}}

Full code:

\documentclass[11pt,english,no-math]{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{fontspec}
\setmainfont[Mapping=tex-text]{Calibri}
\usepackage{geometry}
\geometry{verbose,tmargin=0.8in,bmargin=0.8in,lmargin=0.8in,rmargin=0.8in}



\catcode`_=\active
\newcommand_[1]{\ensuremath{\sb{\scriptscriptstyle #1}}}

\catcode`^=\active
\newcommand^[1]{\ensuremath{\sp{\scriptscriptstyle #1}}}


\usepackage[dvipsnames]{xcolor}

\usepackage{titlesec}
\titleformat*{\section}{\LARGE\bfseries\color{RoyalBlue}}
\titleformat*{\subsection}{\Large\bfseries\color{RoyalBlue}}


\usepackage{xunicode}
\usepackage{polyglossia}
\setdefaultlanguage[variant=american]{english}
\begin{document}


\section{Set up}

\begin{align*}
\int_{n-1}^{n}c_{n}dt & =x\left(i,n\right)\\
\implies c_{n} & =x\left(i,n\right)
\end{align*}

\end{document}
gsab
  • 3
  • 2

1 Answers1

2

The error comes because you're changing category codes before TeX processes certain files that don't expect those category codes:

\catcode`^=\active
\newcommand^[1]{\ensuremath{\sp{\scriptscriptstyle #1}}}

\usepackage[dvipsnames]{xcolor}

This means that xcolor.sty is processed with the new catcode for ^ (not something it is prepared for), which can lead to undesirable results. Similar problems with having this redefinition before \usepackage{xunicode}.

Move these \catcode-changing lines to after all external files have been loaded. Say, just before or after \begin{document}. Then the error goes away.

ShreevatsaR
  • 45,428
  • 10
  • 117
  • 149