如何在 Latex 中的两条垂直线之间添加空格,以便例如输入组基数的通常符号?
答案1
如果在参数的分隔符之间不添加,\cdot
则会导致含义不明确。请考虑以下示例:
\documentclass{article}
\pagestyle{empty}% for cropping
\begin{document}
\ldots where $|\cdot|$ denotes the cardinality of a set\ldots
\[ \aleph = |A| \]
\ldots where $|\ |$ denotes the cardinality of a set\ldots
\[ \aleph = |\ |A \mbox{ or } \aleph = A|\ | \mbox{ or } \aleph = |A| \mbox{?} \]
\ldots where $||$ denotes the cardinality of a set\ldots
\ldots where $\|$ is the delimiter for the 2-norm\ldots
\[ \| v \| \equiv \sqrt{\langle v, v\rangle} \]
\end{document}
答案2
只是为了完成这一切
\documentclass[a4paper]{memoir}
\usepackage{mathtools,etoolbox}
\DeclarePairedDelimiterX\Card[1]\lvert\rvert{
\ifblank{#1}{{-}}{#1}
}
\begin{document}
where $\Card{}$ denotes the cardinality of a set:
\[ \aleph = \Card{A} \]
\end{document}
答案3
另一个变体亨利的回答使用\dots
。
\documentclass[a5paper]{article}
\usepackage{amsmath}
\begin{document}
where $\lvert\dots\rvert$ denotes the cardinality of a set:
\[ \aleph = \lvert A\rvert \]
\end{document}