# How to typeset a double subscript (sic!) not a subsubscript correctly

I have a function fthat I want to restrict to a certain sub-domain of the domain it has been originally defined for. Usually, in mathematics this is illustrated by a vertical bar followed by the restricted set in the lower right of the function symbol. E.g. usually I write

f_{\mid A}


which means f restricted to the set A.

Unfortunately, I have a sequence of functions f_i that has already a subscript. If I write

f_{i_{{\mid A}}}


I do net get an LaTeX error, but the result is semantically wrong. \bar A is not a subscript of i which happens to be a subscript of f, but \mid A is a subscript of f_i. Especially, the font size of {\mid A} should not be smaller than the size of i, but have the same size.

However, if a write

{f_i}_{\mid A}


(which btw would be semantically correct) I get a "double subscript error".

Alternatively, I could write

f_{i \; \mid A}


and get the correct font size for \mid A but it is placed too high. \mid A should be below i.

MWE

\documentclass{article}
\usepackage[TS1,T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}

\begin{document}

$${\hat{f}_i}_{\mid A}$$

\end{document}


As I have already found out, the problem occurs only with the accent above f. But I need the accent there.

• f_{\bar{A}}, f_{i_{\bar{A}}} ... ? May 24, 2017 at 11:41
• You say that “\mid A should be below i.” But should it really? The convention I’ve seen before is that double subscripts are collapsed and put on the same subscript level, at the same size, and sometimes separated by a comma/semicolon. May 24, 2017 at 17:27
• Although I think no-one will be confused, your post and @Zarko's comment both slip into using \bar in place of \mid. Jan 17, 2019 at 20:41

It is a known problem, see Why am I getting a double subscript error?:

{\hat{f}_i}_{|A}


will issue a “double subscript” error. The cure is adding {} to the base.

On the other hand, I can't see so much a difference between this and

\hat{f}_{i\,|A}


which I'd prefer.

Here's the code.

\documentclass{article}

\begin{document}

$$\hat{f}_{i\,|A} \qquad {{}\hat{f}_i}_{|A}$$

\end{document}


Note that \mid A is semantically wrong, although leading to the same result.

• Surely the semantically right symbol is not \mid or | but \rvert? Jan 17, 2019 at 20:42
• @LSpice Surely not \rvert. Jan 17, 2019 at 20:43
• Why not? I thought that indeed this was exactly what it was for, a vertical bar on the right. Surely | is semantically neutral and, in particular, has no idea where or why it is in a formula. Jan 17, 2019 at 20:46