您好,我目前正在使用方程环境,并试图“漂亮地”写下卡方分布的概率分布函数(https://en.wikipedia.org/wiki/Chi_distribution)这是我的序言:
\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}
我的代码片段目前如下所示:
\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}
我的问题是,带有指数等的巨大分数的比例很奇怪,尤其是分母,指数显示得比实际底数大。有没有办法让它更漂亮,也就是说让它看起来更像维基百科页面上的?
答案1
对指数中的分数使用斜线形式;肯定不是\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}
在我看来,带有的版本的\frac
可读性较差。
\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}
答案2
首先要做的是不是在指数中使用\dfrac
。我将此命令替换为\tfrac
(在指数中),并将Γ 函数的参数替换为\mfrac
(中等大小的分数,来自)。为了获得更好的间距,我还用对替换了一对,并改进了指数的布局:nccmath
\left(...\right)
\Bigl(...\Bigr)
-\tfrac{x^2}{2}
\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}