有没有办法协调这里的空间?
\documentclass[a4paper, 12pt, oneside, titlepage]{scrbook}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{colortbl}
\begin{document}
\begin{align*}
P\textcolor{red}{_n} &= 1000 - {q_S} - q_{M\textcolor{red}{_n}} \\
\intertext{\center{bzw.}} \
P\textcolor{blue}{_h} &= 1000 - {q_S} - q_{M\textcolor{blue}{_h}}
\end{align*}
\end{document}
答案1
您发现这\center
是一个非常危险的命令,它只能在其他环境的定义中使用。
您需要的是\centering
(或完全不同的方法)。使用\shortintertext
(需要mathtools
)您会得到更少的空间。
\documentclass[a4paper, 12pt, oneside, titlepage]{scrbook}
\usepackage{amsmath,mathtools}
\usepackage{xcolor}
\begin{document}
\begin{align*}
P_{\textcolor{red}{n}} &= 1000 - {q_S} - q_{M_{\textcolor{red}{n}}} \\
\intertext{bzw.}
P_{\textcolor{blue}{h}} &= 1000 - {q_S} - q_{M_{\textcolor{blue}{h}}}
\end{align*}
\begin{align*}
P_{\textcolor{red}{n}} &= 1000 - {q_S} - q_{M_{\textcolor{red}{n}}} \\
\intertext{\centering bzw.}
P_{\textcolor{blue}{h}} &= 1000 - {q_S} - q_{M_{\textcolor{blue}{h}}}
\end{align*}
\begin{align*}
P_{\textcolor{red}{n}} &= 1000 - {q_S} - q_{M_{\textcolor{red}{n}}} \\
\shortintertext{\centering bzw.}
P_{\textcolor{blue}{h}} &= 1000 - {q_S} - q_{M_{\textcolor{blue}{h}}}
\end{align*}
\end{document}
请注意,用_{\textcolor{red}{n}}
代替的下\textcolor{red}{_n}
标已正确调整字距。
不同方法共用array
:
\documentclass[a4paper, 12pt, oneside, titlepage]{scrbook}
\usepackage{amsmath,array}
\usepackage{xcolor}
\begin{document}
\begin{equation*}
\renewcommand{\arraystretch}{1.2}
\begin{array}{r@{}>{{}}l}
P_{\textcolor{red}{n}} &= 1000 - {q_S} - q_{M_{\textcolor{red}{n}}} \\
\multicolumn{2}{c}{\text{bzw.}}\\
P_{\textcolor{blue}{h}} &= 1000 - {q_S} - q_{M_{\textcolor{blue}{h}}}
\end{array}
\end{equation*}
\end{document}
答案2
给你:
\documentclass[a4paper, 12pt, oneside, titlepage]{scrbook}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{colortbl}
\begin{document}
\begin{align*}
\P\textcolor{red}{_n} &= 1000 - {q_S} - q_{M\textcolor{red}{_n}} \\
\intertext{\hfill{bzw.}\hfill\mbox{}}
P\textcolor{blue}{_h} &= 1000 - {q_S} - q_{M\textcolor{blue}{_h}}
\end{align*}
\end{document}