标记居中文本

标记居中文本

我有两行文本,我想将它们置于文档的中心。我使用了

\begin{center}
\end{center}

要做到这一点,但想用一个符号来标记它,例如黑桃 A,就像我们用数字标记等式一样。

有人知道怎么做吗?我尝试将文本放在方程环境中并使用,\text{}但效果不太好,因为文本不止一行。

答案1

您可以使用array或者像 Barbara Beeton 建议的那样,使用minipage

\documentclass{article}
\usepackage{array}
\newcolumntype{M}[1]{>{\centering\arraybackslash}m{#1}}
\usepackage{amsmath}
\begin{document}
    You could use an \texttt{array}, see \ref{mytext}:
    \[
    \begin{array}{M{.4\textwidth}}% put here the length you like
        Some text which is more than one line.
    \end{array}\label{mytext}\tag{$\spadesuit$}
    \]
    As Barbara Beeton suggested in her comment, also 
    a \texttt{minipage} works, see \ref{barbara}.
    \[
    \begin{minipage}{.4\textwidth}% put here the length you like
        \centering 
        Some text which is more than one line.
    \end{minipage}\label{barbara}\tag{$\clubsuit$}
    \]
\end{document}

在此处输入图片描述

相关内容