![在定义内枚举](https://linux22.com/image/351464/%E5%9C%A8%E5%AE%9A%E4%B9%89%E5%86%85%E6%9E%9A%E4%B8%BE.png)
我有一个用于数学定义的宏,它在“Definition”一词后添加了换行符,除了当我以枚举开始定义时,它工作得很好。在这种情况下有没有办法添加换行符?
\documentclass[12pt,a4paper]{article}
\usepackage[fleqn]{amsmath}
\usepackage{amsthm}
\usepackage{enumitem}
\makeatletter
\newtheoremstyle{TheoStyle}
{}% Space above, empty = `usual value'
{}% Space below
{\itshape}% Body font
{}% Indent amount (empty = no indent, \parindent = para indent)
{\bfseries}% Thm head font
{}% Punctuation after thm head
{\newline}% Space after thm head: \newline = linebreak
{}% Thm head spec
\makeatother
\theoremstyle{TheoStyle}
\theoremstyle{TheoStyle}
\newtheorem*{defn*}{Definition}
\begin{document}
\begin{defn*}
A new definition
\end{defn*}
\begin{defn*}
\begin{enumerate}[label=(\roman*)]
\item Item 1
\item Item 2
\end{enumerate}
\end{defn*}
\end{document}
答案1
您可以使用\mbox{}
开始一个段落,然后使用 进行备份\vspace
。
\begin{defn*}
\mbox{}\vspace{\dimexpr-\baselineskip-\topsep}
\begin{enumerate}[label=(\roman*)]
\documentclass[12pt,a4paper]{article}
\usepackage[fleqn]{amsmath}
\usepackage{amsthm}
\usepackage{enumitem}
\makeatletter
\newtheoremstyle{TheoStyle}
{}% Space above, empty = `usual value'
{}% Space below
{\itshape}% Body font
{}% Indent amount (empty = no indent, \parindent = para indent)
{\bfseries}% Thm head font
{}% Punctuation after thm head
{\newline}% Space after thm head: \newline = linebreak
{}% Thm head spec
\makeatother
\theoremstyle{TheoStyle}
\theoremstyle{TheoStyle}
\newtheorem*{defn*}{Definition}
\begin{document}
\begin{defn*}
A new definition
\end{defn*}
\begin{defn*}
\mbox{}\vspace{\dimexpr-\baselineskip-\topsep}
\begin{enumerate}[label=(\roman*)]
\item Item 1
\item Item 2
\end{enumerate}
\end{defn*}
\end{document}