0

I am trying to use subscripts within a fraction. Using them each on their own works fine, like this:

\documentclass{article}

\usepackage{fixltx2e}
\usepackage{hyperref}
\usepackage{amsmath}

\begin{document}

\texorpdfstring{n\textsubscript{subscript}} \\ \\

\( \frac{n}{2} \) \\ \\ 

\end{document}

I get the desired result:

enter image description here

However, when I combine them into

\( \frac{\texorpdfstring{n\textsubscript{subscript}} }{2} \)

I get the following error:

/Users/niklas/workspace/udemy_tex/my_ownfile/test.tex:15: Extra }, or forgotten \endgroup.
\frac  #1#2->{\begingroup #1\endgroup \@@over #2}

l.15 ...pdfstring{n\textsubscript{subscript}} }{2}

How can this be done?

NiklasR
  • 117

1 Answers1

1

You're using \texorpdfstring the wrong way (as stated here), since \texorpdfstring expects a second argument (else the "or" would be senseless). So trying with:

\(\frac{\texorpdfstring{n\textsubscript{subscript}}{nsub}}{2}\)

would also work.

fractions

Update: Of course you should avoid using such complex mechanisms if you just want to have a subscript in math. LaTeX's own \(n_{\text{subscript}}\) is just sufficient.

TeXnician
  • 33,589