The only way to accomplish the task is to make -
an active character and define it in such a way that it expands to a minus sign in math mode while, in text mode it looks forward to see whether one or two hyphens follow it and act in consequence.
A possible implementation with the active hyphen is as follows
\makeatletter
\def\ah@hyphen{-}
\def\ah@endash{--}
\def\ah@emdash{---}
\catcode`\-=\active
\protected\def-{\ifmmode\ah@hyphen\else\expandafter\ah@check\fi}
\def\ah@check{\@ifnextchar-{\ah@checki}{\ah@hyphen}}
\def\ah@checki#1{\@ifnextchar-{\ah@three}{\ah@two}}
\def\ah@two{\unskip~\ah@endash\space\ignorespaces}
\def\ah@three#1{\unskip~\ah@emdash\space\ignorespaces}
\makeatother
There is, however, a way out using Unicode characters. If your document is written in UTF-8 you can say
\usepackage{newunicodechar}
\newunicodechar{–}{\unskip~--\space\ignorespaces}
\newunicodechar{—}{\unskip~---\space\ignorespaces}
where in line 2 –
is U+2013 EN DASH and in line 3 —
is U+2014 EM DASH; using these characters in your source will do what you want. The main problem here is that they are almost indistinguishable from each other in a monospaced font. Just to show them I'll put them in a code box:
– U+2013 EN DASH
— U+2014 EM DASH
and here's how they appear in a quotation box:
– U+2013 EN DASH
— U+2014 EM DASH
The rendering on screen depends on the font, of course.
Using an accent upon \sum
makes it lose the nature of operator. You simply have to reinstate it:
\documentclass[a4paper,12pt]{article}
\usepackage{amsmath}
\newcommand{\dotsum}{\mathop{\dot\sum}}
\begin{document}
\[
\dotsum_{i \in I}
\sum_{i \in I}
\]
\end{document}
The \sum
next to \dotsum
is just for checking the alignment.
Best Answer
I would input
f'_{3}
.Beside this: it's a feature of TeX, not a bug, that the subscript position change if there is also a superscript. See Appendix G of the TeXbook. But you can change the fontdimens:
The change is global, so if you want to revert it you will have to save the original values. There is also a package
subdepth
which does something similar.