所以我有这个基本代码:
但是分数对齐看起来很糟糕,有什么办法可以解决这个问题吗?
\documentclass[11pt, a4paper]{report}
\usepackage{bm}
\usepackage{amsfonts, graphicx, verbatim, amsmath,amssymb, amsthm, mathrsfs, eufrak}
\usepackage{color}
\usepackage{array}
\usepackage{setspace}% if you must (for double spacing thesis)
\usepackage{fancyhdr}
\usepackage{enumitem}
\usepackage{tikz}
\usepackage{parskip}
\usepackage{lipsum}
\usepackage{floatrow}
\usepackage{commath}
\providecommand{\U}[1]{\protect\rule{.1in}{.1in}}
\begin{document}
Let $h$ be a linear mapping of $V_1$ into $V_2$. Let
\[
h^0 = \frac{1}{\abs G} \sum_{t\in G} (\rho_t^2)^{-1} h \rho_t^1
\]
where $\abs G$ is the order of $G$. Then
\begin{enumerate}[label=(\roman*)]
\item If $\rho^1$ and $\rho^2$ are not isomorphic then we have $h^0=0$
\item If $V_1 = V_2$ and $\rho^1 = \rho^2$, $h^0$ is a scalar multiple of the identity, the scalar being $\frac{1}{n} Tr(h)$ where $n = \dim(V_1)$
\end{enumerate}
\end{document}
正如你所注意到的,它看起来很糟糕。
答案1
该commath
软件包提供了一个非常可疑的实现\abs
。除非绝对必要,否则不要加载此软件包。(旁白:你确实不是对于手头的例子来说。
我建议你不要加载这个包,
加载
mathtools
包而不是amsmath
包。mathtools
无论从哪方面看,包都是amsmath
包的超集;发出指令
\DeclarePairedDelimiter{\abs}{\lvert}{\rvert}
在序言中。这设置了 的正确实现
\abs{...}
。如果您需要自动调整垂直条的大小,只需使用\abs*{...}
。
*附录”:有关如何commath
实现的更多信息\envert
(\abs
只是的别名\envert
):如果\envert{<arg>}
被调用没有可选的大小参数(0
可选的大小参数(和4
),将执行以下代码:
\!\left\lvert#2\right\rvert
正是\!
(“负薄空间”)指令破坏了完整表达式的对称性。要么写入\abs[0]{<arg>}
执行\lvert#2\rvert
,要么更安全地根本不加载,commath
并寻求更清晰的定义\abs
。定义\abs[1]{...}
\abs[4]{...}
。顺便说一句,thru\norm
也搞乱了,和\norm[1]
thru的定义也是如此\norm]4]
。虽然它是可能的\envert
原则上,纠正、\abs
、\enVert
和的错误定义\norm
,最好采用一种可以避免这些复杂情况的设置……
答案2
比较输出
\documentclass[11pt, a4paper]{report}
\usepackage{amsmath}
\usepackage{enumitem}
\usepackage{commath}
\DeclareMathOperator{\Tr}{Tr}
\begin{document}
Let $h$ be a linear mapping of $V_1$ into $V_2$. Let
\[
h^0 = \frac{1}{\abs G} \sum_{t\in G} (\rho_t^2)^{-1} h \rho_t^1
\]
where $\abs G$ is the order of $G$. Then
\begin{enumerate}[label=(\roman*)]
\item If $\rho^1$ and $\rho^2$ are not isomorphic then we have $h^0=0$
\item If $V_1 = V_2$ and $\rho^1 = \rho^2$, $h^0$ is a scalar multiple of the identity,
the scalar being $\frac{1}{n} \Tr(h)$ where $n = \dim(V_1)$
\end{enumerate}
\end{document}
输出为
\documentclass[11pt, a4paper]{report}
\usepackage{amsmath}
\usepackage{enumitem}
\makeatletter
% begin definitions for a "better commath"
\newcommand{\dif}{\mathop{}\!\mathrm{d}}
\newcommand{\Dif}{\mathop{}\!\mathrm{D}}
\newcommand{\spx}[1]{%
\if\relax\detokenize{#1}\relax
\expandafter\@gobble
\else
\expandafter\@firstofone
\fi
{^{#1}}%
}
\newcommand\pd[3][]{\frac{\partial\spx{#1}#2}{\partial#3\spx{#1}}}
\newcommand\tpd[3][]{\tfrac{\partial\spx{#1}#2}{\partial#3\spx{#1}}}
\newcommand\dpd[3][]{\dfrac{\partial\spx{#1}#2}{\partial#3\spx{#1}}}
\newcommand{\md}[6]{\frac{\partial\spx{#2}#1}{\partial#3\spx{#4}\partial#5\spx{#6}}}
\newcommand{\tmd}[6]{\tfrac{\partial\spx{#2}#1}{\partial#3\spx{#4}\partial#5\spx{#6}}}
\newcommand{\dmd}[6]{\dfrac{\partial\spx{#2}#1}{\partial#3\spx{#4}\partial#5\spx{#6}}}
\newcommand{\od}[3][]{\frac{\dif\spx{#1}#2}{\dif#3\spx{#1}}}
\newcommand{\tod}[3][]{\tfrac{\dif\spx{#1}#2}{\dif#3\spx{#1}}}
\newcommand{\dod}[3][]{\dfrac{\dif\spx{#1}#2}{\dif#3\spx{#1}}}
\newcommand{\genericdel}[4]{%
\ifcase#3\relax
\ifx#1.\else#1\fi#4\ifx#2.\else#2\fi\or
\bigl#1#4\bigr#2\or
\Bigl#1#4\Bigr#2\or
\biggl#1#4\biggr#2\or
\Biggl#1#4\Biggr#2\else
\left#1#4\right#2\fi
}
\newcommand{\del}[2][-1]{\genericdel(){#1}{#2}}
\newcommand{\set}[2][-1]{\genericdel\{\}{#1}{#2}}
\let\cbr\set
\newcommand{\sbr}[2][-1]{\genericdel[]{#1}{#2}}
\let\intoo\del
\let\intcc\sbr
\newcommand{\intoc}[2][-1]{\genericdel(]{#1}{#2}}
\newcommand{\intco}[2][-1]{\genericdel[){#1}{#2}}
\newcommand{\eval}[2][-1]{\genericdel.|{#1}{#2}}
\newcommand{\envert}[2][-1]{\genericdel||{#1}{#2}}
\let\abs\envert
\newcommand{\sVert}[1][0]{%
\ifcase#1\relax
\rvert\or\bigr|\or\Bigr|\or\biggr|\or\Biggr
\fi
}
\newcommand{\enVert}[2][-1]{\genericdel\|\|{#1}{#2}}
\let\norm\enVert
\newcommand{\fullfunction}[5]{%
\begin{array}{@{}r@{}r@{}c@{}l@{}}
#1 \colon & #2 & {}\longrightarrow{} & #3 \\
& #4 & {}\longmapsto{} & #5
\end{array}
}
%%% end of the definitions
\makeatother
\DeclareMathOperator{\Tr}{Tr}
\begin{document}
Let $h$ be a linear mapping of $V_1$ into $V_2$. Let
\[
h^0 = \frac{1}{\abs G} \sum_{t\in G} (\rho_t^2)^{-1} h \rho_t^1
\]
where $\abs G$ is the order of $G$. Then
\begin{enumerate}[label=(\roman*)]
\item If $\rho^1$ and $\rho^2$ are not isomorphic then we have $h^0=0$
\item If $V_1 = V_2$ and $\rho^1 = \rho^2$, $h^0$ is a scalar multiple of the identity,
the scalar being $\frac{1}{n} \Tr(h)$ where $n = \dim(V_1)$
\end{enumerate}
\end{document}
代码已在https://tex.stackexchange.com/a/135985/4427并提供了 的完整替代品,避免了它的所有弱点。如果你因为在其他地方使用它的宏和功能而commath
被束缚,这可以拯救你。否则定义commath
\abs
\DeclarePairedDelimiter
Mico 的建议定义 。
例如,您可以注意到“where”和“|”之间的空格减少了。G|” commath
。
无论如何你都应该为“Tr”定义一个操作符名称。
如果你决定这么做,请保存
% begin definitions for a "better commath"
和
% end of the definitions
在工作目录中名为的文件中bettercommath.sty
执行\usepackage{bettercommath}
。