78

I'm a bit puzzled by your statement that $x_{n_i}$ would create output which "just looks like" that of $x_{ni}$ -- this is not the case in the following MWE (minimum working example). I have a hunch that what you want is $x_{n_i}$, but read on. \documentclass{article} \begin{document} \begin{verbatim} $x_{ni}$ or ${x_n}_i$ or $x_{n_i}$? \end{verbatim} $x_{...


45

First of all, the problem presents for textual subscripts, such as those used in physics to distinguish between vectors with the same name (say a force) by a subscripted label that should go in upright type. Textual subscripts are used in many other fields. In what follows, amsmath is assumed. $W_{\rm total}$ is totally wrong as it relies on a deprecated ...


40

Actual solution in LaTeX Just write like\textsubscript{this} You do not need preamble fixes anymore. Example: \documentclass{article} \begin{document} like\textsubscript{this} \end{document} Because all the fixes of package fixltx2e were enabled by default in the LaTeX format in 2015, the odd lack of this "expectable" command in LaTeX kernel is now ...


29

You have to supply a "fake" object for TeX to put indices to: ${}^1_2X^3_4$ However, for chemistry typesetting you should use one of the specialized packages, such as mhchem. This example is taken from mhchem documentation: \ce{^{227}_{90}Th+} It will typeset the symbol for a positive Thorium ion with a charge of 90 and atomic mass of 227.


29

Delay the closing of the group: after _, one can use \bgroup. \documentclass{article} \makeatletter \newcommand\dH{\bgroup d_H\@ifstar{^*\egroup}{\egroup}} \makeatother \begin{document} $B_\dH$ and $B_\dH*$ \end{document} But avoid it.


26

I think you can justly regard this strange behaviour as kind of a bug in TeX's sub- and superscript positioning algorithm; it doesn't make sense that both the sub- and the superscript are raised. See below for some suggestions on how to fix the problem. At the end I offer a new positioning algorithm, and I compare it with the old algorithm. (Sorry for the ...


24

This can be solved using the mathtools package and its command \adjustlimits: \documentclass{article} \usepackage{mathtools} \begin{document} \[ \adjustlimits\sum_{i \in X}\sum_{i \in \bar{X}} \] \end{document}


23

I would recommend using \underaccent from the accents package. For comparison purposes I have included the output \underset and \stackrel: \documentclass{article} \usepackage{amsmath} \usepackage{accents} \usepackage{xcolor} \begin{document} $\quad\color{blue} \text{underset: } \underset{x}{A}$ $\quad\color{black}\text{stackrel: } \stackrel{A}{x}$ $\...


23

You mean \frac{d}{dx}\Bigr|_{\substack{x=1\\y=2}} from the package \usepackage{amsmath} ?


22

I have used the following which puts x -> y under the limit. \lim\limits_{x \to y}


21

Using the fancyvrb package, with the commandchars option you can introduce escape sequences in verbatim code; in particular, you can get boldfaced fonts (provided you are using a suitable font. Using the codes option you can specify catcode changes ; in particualr, this allows you to include formatted mathematics in verbatim text: \documentclass{article} \...


19

Is the result you are looking for? \documentclass{article} \usepackage{amsmath} \usepackage{tensor} \begin{document} $g^{\alpha\beta}g^{\gamma\delta}R_{\alpha\mu\gamma\nu}=R^{\beta\;\delta}_{\;\mu\;\nu}$ $g^{\alpha\beta}g^{\gamma\delta}R_{\alpha\mu\gamma\nu} =\tensor{R}{^\beta_\mu^\delta_\nu}$ \end{document}


19

You can force the subscripts to be under the summation, by using \limits, like this: \sum\limits_{j=1} A_{xj} An alternative way is to change the typesetting style of the formula by using \displaystyle. You probably already noticed, that the typesetting of math differs depending on what 'mode' your in: inline math or display math: \documentclass[10pt,...


18

I'd define a variant of \pmod: \makeatletter \let\@@pmod\pmod \DeclareRobustCommand{\pmod}{\@ifstar\@pmods\@@pmod} \def\@pmods#1{\mkern4mu({\operator@font mod}\mkern 6mu#1)} \makeatother You can use \pmod as before in all other situations and write \[ \sum_{n \equiv 1 \pmod*{k}} ... \] when you need it as a subscript to a sum. Another way might be to ...


18

This essentially duplicates \substack, but adding an alignment point. \documentclass{article} \usepackage{amsmath} \makeatletter \newcommand{\subalign}[1]{% \vcenter{% \Let@ \restore@math@cr \default@tag \baselineskip\fontdimen10 \scriptfont\tw@ \advance\baselineskip\fontdimen12 \scriptfont\tw@ \lineskip\thr@@\fontdimen8 \scriptfont\thr@@ ...


17

You can make _ math active: \AtBeginDocument{ \catcode`_=12 \begingroup\lccode`~=`_ \lowercase{\endgroup\let~}\sb \mathcode`_="8000 } MWE: \documentclass{article} \usepackage[T1]{fontenc} \AtBeginDocument{ \catcode`_=12 \begingroup\lccode`~=`_ \lowercase{\endgroup\let~}\sb \mathcode`_="8000 } \begin{document} a_b $a_b$ \end{document}


17

The standard today is to use mhchem (or similar packages), less typing \documentclass{article} \usepackage[version=4]{mhchem} \begin{document} \ce{CO2} \end{document} The the mhchem documentation for details.


16

\usepackage{subdepth} Example \documentclass{article} \usepackage{subdepth} \begin{document} $a_i a_i^2$ \end{document}


16

This is called subscript and is activated (in math mode) with _: \theta_1 \theta_2 You might (should) be interested in further reading, I recommend the Not So Short Introduction to LaTeX2e (surely available in your language). MWE (some examples) \documentclass{article} \begin{document}\noindent \verb|\theta_1| gives: \( \theta_1 \) ...


16

Correct is a relative concept here. They are giving you different results. If you read the TeXbook then Don Knuth clearly intended to have the input syntax as concise as possible, i.e., I claim for most situations he would maintain that $p_1$ is the input that should be used. However, as mentioned they produce different output, because the ^{} is seen as an ...


16

Why is the vertical positioning different in the two expressions? Because in the first case you're adding subscripts and superscripts to the parenthesis, while in the second case the whole subformula is the nucleus of the math atom to which the superscript and subscript fields are added. Is there anything the LaTeX user should pay attention to to get such ...


16

_ is equal to \sb. Just use $3\sb{x}$.


15

LaTeX provides \raisebox{<len>}{<stuff>} (based on TeX's \raise) which raises (and boxes) <stuff> by <len>. A negative <len> drops the contents: \documentclass{article} \begin{document} It's easy to make subscripts in math mode: $a_i$. How do I make a subscript outside math environment, like\raisebox{-.4ex}{\scriptsize this}? ...


15

I'm pretty sure this is a font bug. As can be seen using FontForge, the anchor for bottom-right subscripts is too far away from the glyph (the anchor is the small dot on the baseline in the third panel): And the result is the same in Microsoft Word, which is the reference implementation for OpenType math: This "works" in XeTeX because XeTeX's OpenType math ...


15

Math fonts do not make ff into a ligature the way text fonts do as it may sometimes obscure the meaning of two separate identifiers juxtaposed, $\tau_{ff}$ $\tau_{f\!f}$ $\tau_{\mathit{ff}}$ If the meaning of your subscript is some kind of invisible product of two f then use one of the first two, or some other negative space other than \! to taste. If on ...


15

Working from Akiiino's answer I came up with this, which also works in display mode \documentclass[a4paper]{article} \usepackage{amsmath} \newcommand{\dotriangle}[1]{% \raisebox{-.7ex}{$\vcenter{#1\kern.2ex\hbox{$\triangle$}\kern.2ex}$}% } \newcommand{\tripow}[3]{% Syntax: \tripow{#1}{#2}{#3} gives you #1 ^ {#2} = #3 \mathop{% We want it to an ...


14

You may want to load the amsmath package to access its \text macro and type (in math mode, obviously): \nu_{\text{FWHM}} Don't use the \rm command in a LaTeX document. Addendum -- @AndrewSwann has pointed out that FHWM, being an acronym, should be typeset in small-caps letters, i.e., as \textsc{fhwm}. Defining the acronym command \FHWM with \newcommand\...


14

The default positions of sub and superscripts are closer to the baseline in textstyle as TeX tries to maximise the chance that the expression does not disturb the paragraph line spacing. Your first example is the standard setting for inline math, however with the larger scripts caused by the subscripting, TeX has to move them further apart. This is ...


Only top voted, non community-wiki answers of a minimum length are eligible