Code: Select all
$\mu_x^j$
Code: Select all
$\mu_{x+s}^j$
is there a way to make the 'j' cetering to the 'x+s'?
so 'j' is actually 'above' '+' in this case?
just as if
Code: Select all
\mu_{\stackrel{j}{x+s}}
Thanks.
casper
Code: Select all
$\mu_x^j$
Code: Select all
$\mu_{x+s}^j$
Code: Select all
\mu_{\stackrel{j}{x+s}}
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
Code: Select all
\documentclass{article}
\begin{document}
$\mu_{x+s}^{\phantom{x}j\phantom{s}}$
\end{document}
Code: Select all
\documentclass{article}
\usepackage{amsmath}
\usepackage{ifthen}
\usepackage{calc}
\newlength\mylena
\newlength\mylenb
\newlength\mylenc
% syntax: \mysp{<base>}{<subscript>}{<superscript>}
\newcommand\mysp[3]{%
\settowidth\mylena{$\scriptstyle _#2$}%
\settowidth\mylenb{$\scriptstyle \sp{#3}$}%
\ifthenelse{\mylena<\mylenb}
{%
\setlength\mylenc{\mylenb-\mylena}%
#1_{\hbox{\hskip.5\mylenc$\scriptstyle #2$}}^{#3}%
}
{
\setlength\mylenc{\mylena-\mylenb}
#1_{#2}^{\hbox{\hskip.5\mylenc$\scriptstyle #3$}}%
}%
}
\begin{document}
$\mysp{\mu}{xxxx}{j}$
$\mysp{\beta}{xxx}{j}$
$\mysp{\alpha}{x}{j}$
$\mysp{\mu}{x}{jjjj}$
$\mysp{\beta}{x}{jjj}$
$\mysp{\alpha}{x}{jj}$
\end{document}
Thanks!gmedina wrote:Try this improved version:
Code: Select all
\documentclass{article} \usepackage{amsmath} \usepackage{ifthen} \usepackage{calc} \newlength\mylena \newlength\mylenb \newlength\mylenc % syntax: \mysp{<base>}{<subscript>}{<superscript>} \newcommand\mysp[3]{% \settowidth\mylena{$\scriptstyle _#2$}% \settowidth\mylenb{$\scriptstyle \sp{#3}$}% \ifthenelse{\mylena<\mylenb} {% \setlength\mylenc{\mylenb-\mylena}% #1_{\hbox{\hskip.5\mylenc$\scriptstyle #2$}}^{#3}% } { \setlength\mylenc{\mylena-\mylenb} #1_{#2}^{\hbox{\hskip.5\mylenc$\scriptstyle #3$}}% }% } \begin{document} $\mysp{\mu}{xxxx}{j}$ $\mysp{\beta}{xxx}{j}$ $\mysp{\alpha}{x}{j}$ $\mysp{\mu}{x}{jjjj}$ $\mysp{\beta}{x}{jjj}$ $\mysp{\alpha}{x}{jj}$ \end{document}
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p