7

How can I give one line in LaTeX more vertical height so that something like

$\frac{n^n}{{2}^{2n} * {n^n}^{2}}$

displays correctly? I mean, how to give the {2} term more vertical displacement, so that it looks like it's above the top n in the term {n^n}^{2} in the denominator?

Note that increasing line spacing doesn't work because LaTeX does not fill the space with the characters. (When I searched for this ability, this was all that came up.)

  • 2
    Could you please add a minimal example which reproduces your problem? – CarLaTeX Feb 1 at 4:13
  • You can add additional space using {\fboxrule=0pt \fbox{...}} – John Kormylo Feb 1 at 4:22
8

I think the denominator of your \frac expression suffers from two issues:

  • a "cramped" look, i.e., the exponents are not raised much above the baseline
  • first- and second-order exponents are raised to (very nearly) the same height

How to remedy these issues?

  • To address the first issue, switch to "uncramped" mode -- see the \ufrac macro below.

  • To remedy the second issue, I suggest you switch from {n^n}^2 to n^{n^2}. (The two forms are the same, mathematically speaking, but they are quite differnt from a typographic point of view.) That, or use parentheses to visually "enclose" the n^n term.

    Alternatively, consider switching from "standard" \frac notation to inline-fraction notation.

Whatever else you do, please don't use the unnecessary * multiplication symbol. If you can't do without an explicit multiplication symbol, do use \cdot, not *.

enter image description here

\documentclass{article}

%% "uncramped" \frac macro:
%% (Source: @egreg [who else?!], https://tex.stackexchange.com/a/337334/5001)
\makeatletter
\newcommand{\ufrac}[2]{% 
   \frac{#1}{\mathpalette\ufrac@den{#2}}}
\newcommand{\ufrac@den}[2]{#1#2}
\makeatother

\begin{document}
inline math mode, \verb+\frac+ notation

$\frac{n^n}{{2}^{2n} * {n^n}^{2}} % OP's expression
 \quad
 \ufrac{n^n}{2^{2n} n^{n^2}}   
 \quad
 \ufrac{n^n}{2^{2n} (n^n)^2}$ 

\bigskip
display math mode, \verb+\frac+ notation

\smallskip
$\displaystyle 
 \frac{n^n}{2^{2n} n^{n^2}}
 \quad
 \ufrac{n^n}{2^{2n} n^{n^2}} 
 \quad
 \ufrac{n^n}{2^{2n} (n^n)^2}$

\bigskip
inline-frac notation

\smallskip
$n^n/(2^{2n} n^{n^2})           
 \quad
 n^n/(2^{2n} (n^n)^2)$ 
\end{document}
  • 1
    I specially like the 3rd option instead of the first one. We need more parentheses, but we guarantee not to destroy line spacing (and sometines it is visually better). Thanks for showing us the options! – manooooh Feb 1 at 7:10
6

Does this go in the right direction?

\documentclass[fleqn]{article}

\begin{document}
\paragraph{Original:}
$\frac{n^n}{{2}^{2n} * {n^n}^{2}}$
\[\frac{n^n}{{2}^{2n} * {n^n}^{2}}\]

\paragraph{Proposal:}
$\frac{n^n}{{2}^{2n} * {\mathstrut n^n}^{2}}$
\[\frac{n^n}{{2}^{2n} * {\mathstrut n^n}^{2}}\]


\paragraph{With brackets:}
$\frac{n^n}{{2}^{2n} * ( n^n)^{2}}$

\[\frac{n^n}{{2}^{2n} * (n^n)^{2}}\]

\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.