一開始我使用,\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}