我需要一个方程式,其中方程式本身位于中心并且方程式编号(自定义标签)位于更左边。
\documentclass[a4paper,12pt,numbers=noenddot]{scrartcl}
\usepackage{mathtools}
\usepackage{amsmath}
\begin{document}
%here the equation number is at the far right
\begin{align}
\tag{\text{tag}}
2 + 2 = 4
\end{equation}
%and here the equation number is indented, but the equation itself is not centered
\begin{align*}
2 + 2 &= 4
&&\text{tag}
%and here a bracket remains on the right side
\begin{equation}
\tag{\text{tag}\qquad\quad}
2 + 2 = 4
\end{equation}
\end{document}
我怎样才能解决这个问题?
答案1
像这样吗?
使用\usetagform{indented}
来切换到替代标签格式,\mytag{...}
生成替代标签,并\usetagform{default}
切换回默认标签格式。
\documentclass[a4paper,12pt,numbers=noenddot]{scrartcl}
\usepackage{mathtools} % for '\newtagform' and '\usetagform' macros
\newtagform{indented}{}{\hspace*{15mm}} % set the desired indentation amount
\newcommand\mytag[1]{\tag{\llap{(#1)}}}
\begin{document}
\begin{equation} 2 + 2 = 4 \end{equation}
\usetagform{indented}
\stepcounter{equation}
\begin{equation} 2 + 2 = 4 \mytag{\theequation}\end{equation}
\begin{equation} 2 + 2 = 4 \mytag{Message of the Day}\end{equation}
\usetagform{default} % switch back to default
\begin{equation} 2 + 2 = 4 \end{equation}
\end{document}
答案2
如果您确实需要这个,您可以将空格添加到设置标签的命令中:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
zzz
\begin{equation}
1=0
\end{equation}
\makeatletter
\def\tagform@#1{\maketag@@@{(\ignorespaces#1\unskip\@@italiccorr)\hspace{1cm}}}
\makeatother
zzz
\begin{equation}
1=0
\end{equation}
\end{document}
或者也许你只是在寻找一个两边都缩进的引文:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
zzz
\begin{equation}
1=0
\end{equation}
\begin{quote}
zzz
\begin{equation}
1=0
\end{equation}
\end{quote}
\end{document}