1

Hello i am currently using the equation environment and trying to "prettily" write down the probability distribution function of the chi-distribution (https://en.wikipedia.org/wiki/Chi_distribution) This is my preamble:

\documentclass[11pt,a4paper,ngerman]{scrreprt}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{scrlayer-scrpage}
\pagestyle{scrheadings}
\ofoot[\pagemark]{\pagemark}
\cfoot[]{}
\author{James Oliver Reppin}
\usepackage[onehalfspacing]{setspace}
\usepackage{tocloft}
\addtocontents{toc}{\cftpagenumbersoff{chapter}}
\usepackage{amsmath}

My code snippet currently looks like this:

\begin{document}
\renewcommand{\cftchapleader}{\cftdotfill{\cftdotsep}} 
\renewcommand{\cftsecleader}{\cftdotfill{\cftdotsep}}
\renewcommand{\thechapter}{\arabic{chapter}.}
\renewcommand{\thesection}{\thechapter\arabic{section}.}
\renewcommand{\thesubsection}{\thesection\arabic{subsection}.} 
\renewcommand{\theequation}{\arabic{chapter}.\arabic{equation}}
\chapter{asd}
\section{asd1}
\subsection{Chi-distribution}
\begin{equation}
    \begin{aligned}
&f(x) = \dfrac{x^{k-1}e^{-\dfrac{x^{2}}{2}}}{2^{\dfrac{k}{2}} \Gamma\left(\dfrac{k}{2}\right)},\;\;x\in \left[0,\infty\right),\;\;k>0\\
&blabla
\end{equation}
\end{document}

My problem is, the huge fraction with exponents and such is weirdly proportioned, especially the denominator, where the exponents are displayed bigger than the actual base. Is there a way to make it prettier, aka have it look more like on the wikipedia page?

6
  • Please make your example into a simple piece of code that others can just copy and test as is. Sniplets like this are not particularly useful
    – daleif
    Sep 7 '20 at 14:46
  • i edited the question, i think with the preamble and the snipped one should be able to recreate my problem, since i just left out the bibliography, titlepage and the table of content
    – James
    Sep 7 '20 at 14:51
  • you are over-riding the normal styling and forcing display style fractions in a superscript which will look weird. also don't use aligned for single line equations Sep 7 '20 at 14:53
  • 1
    you have posted two fragments but neither allows anyone to simply run the example. can you replace themby a single small but complete example Sep 7 '20 at 14:57
  • 1
    yes there are rather few case where dfrac should be used Sep 7 '20 at 14:58
4

Use the slashed form for fractions in exponents; surely not \dfrac.

\begin{equation}
\begin{aligned}
&f(x) =
  \dfrac{x^{k-1}e^{-x^2/2}}{2^{k/2}\Gamma(k/2)},
  \qquad x\in [0,\infty),\quad k>0\\
&blabla
\end{aligned}
\end{equation}

enter image description here

The version with \frac is much less readable, in my opinion.

\begin{equation}
\begin{aligned}
&f(x) =
  \dfrac{x^{k-1}e^{-\frac{x^2}{2}}}{2^{\frac{k}{2}}\Gamma\Bigl(\dfrac{k}{2}\Bigr)},
  \qquad x\in [0,\infty),\quad k>0\\
&blabla
\end{aligned}
\end{equation}

enter image description here

1
  • i like your first method using the slashed form the most, so i upvoted your answer as the solution!
    – James
    Sep 8 '20 at 12:10
1

The first thing to do is to not use \dfrac in exponents. I replaced this command with \tfrac (in the exponents) and with \mfrac (medium-sized fraction, from nccmath) for the argument of the Γ function. For a better spacing I also replaced a pair \left(...\right) with the pair \Bigl(...\Bigr) and improved the layout of the -\tfrac{x^2}{2} exponent:

\documentclass[11pt,a4paper,ngerman]{scrreprt}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{scrlayer-scrpage}
\pagestyle{scrheadings}
\ofoot[\pagemark]{\pagemark}
\cfoot[]{}
\author{James Oliver Reppin}
\usepackage[onehalfspacing]{setspace}
\usepackage{nccmath, mathtools}
\renewcommand{\thechapter}{\arabic{chapter}.}
\renewcommand{\thesection}{\thechapter\arabic{section}.}
\renewcommand{\thesubsection}{\thesection\arabic{subsection}.}
\renewcommand{\theequation}{\arabic{chapter}.\arabic{equation}}

\begin{document}

\chapter{asd}
\section{asd1}
\subsection{Chi-distribution}

\begin{equation}
    \begin{aligned}
&f(x) = \dfrac{x^{k-1}e^{-\tfrac{\,x^{\mathrlap{2}}}{2}}}{2^{\tfrac{k}{2}}\, \Gamma\Bigl(\mfrac{k}{2}\Bigr)},\;\;x\in \left[0,\infty\right),\;\;k>0\\
&blabla
\end{aligned}
\end{equation}

\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.