一开始我使用它\numberwithin{equation}{subsection}
,所以每次我使用\begin{equation}
环境时,它都会根据章节或小节在右侧标记我的方程式。
\documentclass[12pt]{article}
\usepackage{titlesec}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amssymb}
\usepackage{enumerate}
\setlength{\textwidth}{16cm}
\setlength{\textheight}{23cm}
\setlength{\oddsidemargin}{0cm}
\setlength{\topmargin}{0cm}
\title{{\textbf{\textrm TITLE}}}
\author{Bruce}
\date{\today}
\usepackage{xcolor}
\numberwithin{equation}{subsection}
\newsavebox\thmbox
\newtheorem{mytheorem}{Theorem}
\newenvironment{theorem}%
{\begin{lrbox}{\thmbox}%
\begin{minipage}{\dimexpr\linewidth-2\fboxsep}
\begin{mytheorem}}%
{\end{mytheorem}%
\end{minipage}%
\end{lrbox}%
\begin{trivlist}
\item[]\colorbox{lightgray}{\usebox\thmbox}
\end{trivlist}}
\newtheorem{mydef}{Definition}
\begin{document}
\maketitle
\section{First Chapter}
\subsection{First subsection}
\begin{equation}
F=ma
\end{equation}
\begin{theorem}
Force is equal mass times acceleration.
\end{theorem}
\end{document}
它将标记F=ma
为 (1.1.1)。现在我也想使用相同的编号系统对我的句子进行编号,而不将整个句子居中。例如,如果我使用
\begin{equation}
\mbox{Force is equal mass times acceleration.}
\end{equation}
它仍会为句子编号,但其输出就像一个方程(居中)。我该如何解决这个问题?
我尝试在\theorem
环境中添加更多文本。但它们之间的间距太大,还是我使用的代码不正确flalign
?
\begin{theorem}
\begin{flalign}
\text{(1)Force is equal mass times acceleration.}&&
\end{flalign}
\begin{flalign}
\text{(2)Mass in conserved in general.}&&
\end{flalign}
\end{theorem}
答案1
您可以在句末使用doubleflalign
来代替:equation
&
\begin{flalign}
\text{Force is equal mass times acceleration.}&&
\end{flalign}
MWE(注意使用\text
而不是\mbox
)
\documentclass[12pt]{article}
\usepackage{titlesec}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amssymb}
\usepackage{enumerate}
\setlength{\textwidth}{16cm}
\setlength{\textheight}{23cm}
\setlength{\oddsidemargin}{0cm}
\setlength{\topmargin}{0cm}
\title{{\textbf{\textrm TITLE}}}
\author{Bruce}
\date{\today}
\usepackage{xcolor}
\numberwithin{equation}{subsection}
\newsavebox\thmbox
\newtheorem{mytheorem}{Theorem}
\newenvironment{theorem}%
{\begin{lrbox}{\thmbox}%
\begin{minipage}{\dimexpr\linewidth-2\fboxsep}
\begin{mytheorem}}%
{\end{mytheorem}%
\end{minipage}%
\end{lrbox}%
\begin{trivlist}
\item[]\colorbox{lightgray}{\usebox\thmbox}
\end{trivlist}}
\newtheorem{mydef}{Definition}
\begin{document}
\maketitle
\section{First Chapter}
\subsection{First subsection}
\begin{equation}
F=ma
\end{equation}
\begin{flalign}
\text{Force is equal mass times acceleration.}&&
\end{flalign}
\begin{theorem}
Force is equal mass times acceleration.
\end{theorem}
\end{document}
输出
编辑
我不知道你想达到什么目的,也许是这个?
为此,请在序言中添加以下几行
\makeatletter
\newcommand{\numleft}{\tagsleft@true}
\newcommand{\numright}{\tagsleft@false}
\makeatother
第一行模拟leqno
的选项amsmath
,第二行模拟 的选项reqno
。
像使用它们一样
\begin{theorem}
\numleft
\begin{flalign}
\qquad\qquad&\text{Force is equal mass times acceleration.}&\\
\qquad\qquad&\text{Force is equal mass times acceleration again.}&
\end{flalign}
\numright
\end{theorem}
完整代码
\documentclass[12pt]{article}
\usepackage{titlesec}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amssymb}
\usepackage{enumerate}
\setlength{\textwidth}{16cm}
\setlength{\textheight}{23cm}
\setlength{\oddsidemargin}{0cm}
\setlength{\topmargin}{0cm}
\title{{\textbf{\textrm TITLE}}}
\author{Bruce}
\date{\today}
\makeatletter
\newcommand{\numleft}{\tagsleft@true}
\newcommand{\numright}{\tagsleft@false}
\makeatother
\usepackage{xcolor}
\numberwithin{equation}{subsection}
\newsavebox\thmbox
\newtheorem{mytheorem}{Theorem}
\newenvironment{theorem}%
{\begin{lrbox}{\thmbox}%
\begin{minipage}{\dimexpr\linewidth-2\fboxsep}
\begin{mytheorem}}%
{\end{mytheorem}%
\end{minipage}%
\end{lrbox}%
\begin{trivlist}
\item[]\colorbox{lightgray}{\usebox\thmbox}
\end{trivlist}}
\newtheorem{mydef}{Definition}
\begin{document}
\maketitle
\section{First Chapter}
\subsection{First subsection}
\begin{equation}
F=ma
\end{equation}
\begin{theorem}
\numleft
\begin{flalign}
\qquad\qquad&\text{Force is equal mass times acceleration.}&\\
\qquad\qquad&\text{Force is equal mass times acceleration again.}&
\end{flalign}
\numright
\end{theorem}
\end{document}