我目前正在 Lyx 中使用“文档”>“设置”>“模块”>“定理(按章节内类型编号)”。
然而,我需要根据小节对我的定理/定义进行编号。即
2 简介
2.1 小节...
定义2.1.1
定理 2.1.2
2.2 第 2 节
定理2.2.1
此外,我还希望标签后的文本位于新行中(而不是在粗体文本后继续),即
定义2.2.2
公式的定义是...
我还想说明一下,我对 lyx 还很陌生,所以我不熟悉如何在编辑器中编辑 TeX 代码(如果需要),因此如果能提供详细的步骤我将非常感谢。
谢谢你!
编辑 1:MWE(我删除了大部分与字体相关的代码)
% Preview source code
#LyX 2.2 created this file. For more info see http://www.lyx.org/
\lyxformat 508
\begin_document
\begin_header
\save_transient_properties true
\origin unavailable
\textclass article
\use_default_options true
\begin_modules
theorems-ams-bytype
theorems-sec-bytype
\end_modules
\maintain_unincluded_children false
\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize default
\spacing single
\use_hyperref false
\papersize default
\use_geometry false
\use_package amsmath 1
\use_package amssymb 1
\use_package cancel 1
\use_package esint 1
\use_package mathdots 1
\use_package mathtools 1
\use_package mhchem 1
\use_package stackrel 1
\use_package stmaryrd 1
\use_package undertilde 1
\cite_engine basic
\cite_engine_type default
\biblio_style plain
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\justification true
\use_refstyle 1
\index Index
\shortcut idx
\color #008000
\end_index
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\paragraph_indentation default
\quotes_language english
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes false
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\end_header
\begin_body
\begin_layout Standard
\noindent
\begin_inset CommandInset toc
LatexCommand tableofcontents
\end_inset
\end_layout
\begin_layout Standard
\paragraph_spacing onehalf
\noindent
\begin_inset Newpage newpage
\end_inset
\end_layout
\begin_layout Section
\paragraph_spacing onehalf
\noindent
Title
\series bold
1
\begin_inset ERT
status open
\begin_layout Plain Layout
\backslash
numberwithin{equation}{section}
\end_layout
\end_inset
\begin_inset ERT
status open
\begin_layout Plain Layout
\backslash
setlength{
\backslash
parindent}{1.5pt}
\end_layout
\end_inset
\end_layout
\begin_layout Section
\paragraph_spacing onehalf
\noindent
Title 2
\end_layout
\begin_layout Subsection
\paragraph_spacing onehalf
\noindent
Sub 1
\end_layout
\begin_layout Subsection
\paragraph_spacing onehalf
\noindent
Sub 2
\end_layout
\begin_layout Definition
\noindent
My first definition
\end_layout
\end_body
\end_document
答案1
我不知道在 LyX 中是否可以实现这一点,但您必须将以下内容添加到序言中才能获得它:
\newtheoremstyle{break}%
{5pt}{4pt}% spaces added before and after the environment
{\itshape}{}%
{\bfseries}{}% % Note that final punctuation is omitted.
{\newline}{}
\theoremstyle{break}
\newtheorem{theorem}{Theorem}[subsection]
\newtheoremstyle{defbreak}%
{5pt}{4pt}% spaces added before and after the environment
{\upshape}{}%
{\bfseries}{}% % Note that final punctuation is omitted.
{\newline}{}
\theoremstyle{defbreak}
\newtheorem{defn}{Definition}[subsection]
以下是完整代码(略有修改):
\documentclass{article}
\usepackage{amsthm}
\usepackage{lipsum}
\newtheoremstyle{break}%
{5pt}{4pt}% spaces added before and after the environment
{\itshape}{}%
{\bfseries}{}% % Note that final punctuation is omitted.
{\newline}{}
\theoremstyle{break}
\newtheorem{thm}{Theorem}[subsection]
\newtheoremstyle{defbreak}%
{5pt}{4pt}% spaces added before and after the environment
{\upshape}{}%
{\bfseries}{}% % Note that final punctuation is omitted.
{\newline}{}
\theoremstyle{defbreak}
\newtheorem{Def}{Definition}[subsection]
\begin{document}
\section{Introduction}
\subsection{A first subsection}
\lipsum[3]
\begin{thm}
A silly test theorem. A silly test theorem. A silly test theorem. A silly test theorem. A silly test theorem.
\end{thm}
\lipsum[4]
\begin{Def}
This is a \texttt{defbreak} style example. Some text. Some more text. Some more text. Some more text.
\end{Def}
\lipsum[5]
\end{document}
答案2
一个好的解决方案是需要制作你自己的模块,但是穷人的解决方案可能是:
1)不加载任何模块。
2)将其插入Document> Stetings...>LaTeX Preamble
\usepackage{amsthm}
\newtheoremstyle{xxx}{}{}{\itshape}{}{\scshape\bfseries}{:}%
{\newline}{\thmname{#1}\thmnumber{ #2}\thmnote{(#3)}\smallskip}%
\theoremstyle{xxx}
\newtheorem{xxx}{\protect\theoremname}[subsection]
\providecommand{\theoremname}{Smart theorem}
\begin{xxx} ... \end{xxx}
3)在 ERT 框 ( Ctrl+ ) 中写上你的定理,或者分别为和L写两个 ERT 框,并将定理文本保留为普通段落。\begin{xxx}
\end{xxx}
结果必须与此 LaTeX 源代码等效:
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{amsthm}
\newtheoremstyle{xxx}{}{}{\itshape}{}{\scshape\bfseries}{:}%
{\newline}{\thmname{#1}\thmnumber{ #2}\thmnote{(#3)}\smallskip}
\theoremstyle{xxx}
\newtheorem{xxx}{\protect\theoremname}[subsection]
\providecommand{\theoremname}{Smart theorem}
\begin{document}
\section{xxx}
Bla bla bla ...
\subsection{adasd}
\begin{xxx}
Bla bla bla ...
\end{xxx}
Bla bla bla ...
\end{document}
显然,您可以将样式更改xxx
为更有意义的名称,并将的参数更改\newtheoremstyle
为更适合您所需的布局。运行texdoc amsmath
以获取有关参数的信息。