答案1
您可以加载amsmath
包,设置未编号的显示数学环境,并使用\tag*
宏将解释字符串右对齐。例如:
(垂直线仅表示文本块的边界。)
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[
a^2+b^2=c^2 \tag*{Pythagoras}
\]
\end{document}
附录-- 如果参数的\tag*
宽度不超过大约 1 英寸,则上面显示的方法可以将等式置于文本块的中心。如果您需要排版的文本多于一行 1 英寸的长度,我建议您将其放在如下环境中tabular
-- 再次,垂直框线只是为了指示文本块的边缘:
\documentclass{article}
\usepackage{amsmath, % for '\tag*' macro
array, % for '\newcolumntype' macro
ragged2e} % for '\RaggedLeft' macro
\newcolumntype{P}[1]{>{\RaggedLeft}p{#1}}
\usepackage{showframe} % just for this example
\begin{document}
\[
a^2+b^2=c^2
\]
\[
a^2+b^2=c^2 \tag*{Pythagoras}
\]
\[
a^2+b^2=c^2
\tag*{%
\begin{tabular}{@{}P{1in}@{}}
Way past the seven hills, in the hut of
the seven dwarfs, there lived\dots
\end{tabular}}
\]
\end{document}
答案2
梅威瑟:
\documentclass[]{article}
\usepackage{geometry}
\usepackage{lipsum}
\usepackage{array,tabularx,mathtools}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\newcolumntype{R}{>{\raggedleft\arraybackslash}X}
\begin{document}
\lipsum[2]
\[
\begin{tabularx}{\textwidth}{@{}CCR@{}}
& $\mod(R,M)\cong M$ & Any $M$ module $M$
\end{tabularx}
\]
\lipsum[2]
\end{document}
答案3
有点复杂,但这也是可行的:
% My standard header for TeX.SX answers:
\documentclass[a4paper]{article} % To avoid confusion, let us explicitly
% declare the paper format.
\usepackage[T1]{fontenc} % Not always necessary, but recommended.
% End of standard header. What follows pertains to the problem at hand.
\usepackage{amsmath}
\begin{document}
Text before.
\begin{flalign*}
&&a^2+b^2&=c^2
&\llap{Pythagoras' Theorem}
\end{flalign*}
Text in between.
\[
a^2+b^2=c^2
\]
Text after.
\end{document}
输出: