lyx 中的 \swapnumbers

lyx 中的 \swapnumbers

我在 Mac 上使用 LyX 2.2dev 以及定理 (AMS)、定理 (AMS-Extended)、按节编号方程和定理 (按节编号) 模块。我在 LaTeX 序言中放入了 \swapnumbers,但数字仍然没有交换。

另外,定义一个新的定理或定义似乎需要缩进一个新段落,而我希望定理的编号从最左边开始。

编辑 下面是一张可以说明我的意思的图片: 在此处输入图片描述

以下是我所指的“MWE”:原始 LyX 文件:


#LyX 2.2 created this file. For more info see http://www.lyx.org/
\lyxformat 479
\begin_document
\begin_header
\textclass amsbook
\begin_preamble
\usepackage[breaklinks,colorlinks=true,linkcolor=blue,
citecolor=blue, urlcolor=blue]{hyperref}
\usepackage{braket}
\usepackage{mathtools}
\DeclarePairedDelimiter\abs{\lvert}{\rvert}%
\DeclarePairedDelimiter\norm{\lVert}{\rVert}%
\let\oldnorm\norm
\def\norm{\@ifstar{\oldnorm}{\oldnorm*}}
\makeatother
\usepackage{amsfonts}
\usepackage{dsfont}
\renewcommand{\vec}[1]{\mathbf{#1}}
\usepackage[scaled=0.88]{beraserif}
\usepackage[scaled=0.85]{berasans}
\usepackage[scaled=0.84]{beramono}
\usepackage[T1]{fontenc}
\usepackage{mathpazo}
\usepackage[T1,small,euler-digits]{eulervm}
\end_preamble
\options reqno
\use_default_options true
\begin_modules
theorems-ams
eqs-within-sections
figs-within-sections
theorems-sec
\end_modules
\maintain_unincluded_children false
\language english
\language_package default
\inputencoding auto
\fontencoding global
\font_roman default
\font_sans default
\font_typewriter default
\font_math auto
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100
\font_tt_scale 100
\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize default
\spacing single
\use_hyperref false
\pdf_bookmarks true
\pdf_bookmarksnumbered false
\pdf_bookmarksopen false
\pdf_bookmarksopenlevel 1
\pdf_breaklinks false
\pdf_pdfborder false
\pdf_colorlinks true
\pdf_backref false
\pdf_pdfusetitle true
\papersize a4paper
\use_geometry true
\use_package amsmath 1
\use_package amssymb 1
\use_package cancel 1
\use_package esint 0
\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
\leftmargin 1cm
\topmargin 1cm
\rightmargin 1cm
\bottommargin 1cm
\secnumdepth 5
\tocdepth 3
\paragraph_separation indent
\paragraph_indentation default
\quotes_language english
\papercolumns 1
\papersides 1
\paperpagestyle default
\bullet 1 0 9 -1
\bullet 3 0 7 -1
\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 Title
Title
\end_layout

\begin_layout Chapter
First Chapter
\end_layout

\begin_layout Section
First Section
\end_layout

\begin_layout Standard
Here is some text.
 As it begins a paragraph, it starts indented.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
\end_layout

\begin_layout Claim
Some Claim [some words some words some words some words some words some
 words some words some words some words some words some words some words
 some words some words some words some words some words some words some
 words some words some words some words some words some words]
\end_layout

\begin_layout Definition
Some Definition
\end_layout

\end_body
\end_document

LyX 诱导的 LaTeX 示例:


%% LyX 2.2.0dev created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[oneside,english,reqno]{amsbook}
\usepackage[T1]{fontenc}
\usepackage[utf8]{luainputenc}
\usepackage[a4paper]{geometry}
\geometry{verbose,tmargin=1cm,bmargin=1cm,lmargin=1cm,rmargin=1cm}
\setcounter{secnumdepth}{5}
\usepackage{amsthm}

\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands.
\numberwithin{section}{chapter}
\numberwithin{equation}{section}
\numberwithin{figure}{section}
\theoremstyle{plain}
\newtheorem{thm}{\protect\theoremname}[section]
  \theoremstyle{remark}
  \newtheorem{claim}[thm]{\protect\claimname}
  \theoremstyle{definition}
  \newtheorem{defn}[thm]{\protect\definitionname}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usepackage[breaklinks,colorlinks=true,linkcolor=blue,
citecolor=blue, urlcolor=blue]{hyperref}
\usepackage{braket}
\usepackage{mathtools}
\DeclarePairedDelimiter\abs{\lvert}{\rvert}%
\DeclarePairedDelimiter\norm{\lVert}{\rVert}%
\let\oldnorm\norm
\def\norm{\@ifstar{\oldnorm}{\oldnorm*}}
\makeatother
\usepackage{amsfonts}
\usepackage{dsfont}
\renewcommand{\vec}[1]{\mathbf{#1}}
\usepackage[scaled=0.88]{beraserif}
\usepackage[scaled=0.85]{berasans}
\usepackage[scaled=0.84]{beramono}
\usepackage[T1]{fontenc}
\usepackage{mathpazo}
\usepackage[T1,small,euler-digits]{eulervm}

\AtBeginDocument{
  \def\labelitemii{\(\circ\)}
  \def\labelitemiv{\(\star\)}
}

\makeatother

\usepackage{babel}
  \providecommand{\claimname}{Claim}
  \providecommand{\definitionname}{Definition}
\providecommand{\theoremname}{Theorem}

\begin{document}

\title{Title}
\maketitle

\chapter{First Chapter}

\section{First Section}

Here is some text. As it begins a paragraph, it starts indented. Bla
bla bla. Bla bla bla. Bla bla bla. Bla bla bla. Bla bla bla. Bla bla
bla. Bla bla bla. Bla bla bla. Bla bla bla. Bla bla bla. Bla bla bla.
Bla bla bla. Bla bla bla. Bla bla bla. Bla bla bla. Bla bla bla. Bla
bla bla. Bla bla bla. Bla bla bla. Bla bla bla. Bla bla bla. Bla bla
bla. Bla bla bla. Bla bla bla. Bla bla bla. Bla bla bla.
\begin{claim}
Some Claim {[}some words some words some words some words some words
some words some words some words some words some words some words
some words some words some words some words some words some words
some words some words some words some words some words some words
some words{]}
\end{claim}
\begin{defn}
Some Definition
\end{defn}

\end{document}

答案1

感谢您的友好 MWE 和清晰的问题!

这里的问题是,您需要在 LaTeX 前言的顶部附近放置一些内容。LyX 中的前言只是整个 LaTeX 前言的一部分。您加载的 LyX 模块所贡献的前言部分恰好位于用户前言之上。正如 @barbara beeton 在评论中所述,您需要将命令\swapnumbers放在\newtheorem命令之前。在 LyX 中,有几种不同的方法可以解决这个问题。一种方法如下。我们定义一个“本地布局”(阅读帮助 > 自定义以了解更多信息),它恰好在其他模块之前输出。

为此,请转到“文档”>“设置”>“本地布局”并输入以下内容:

Preamble
\swapnumbers
EndPreamble

然后按“验证”。然后按“确定”。就这样。

这会导致以下 .lyx 文件(我的 LyX 开发比你的稍微新一些,因此可以更新并重新编译,或者只需将 480 替换为 479 就可以了):

#LyX 2.2 created this file. For more info see http://www.lyx.org/
\lyxformat 480
\begin_document
\begin_header
\textclass amsbook
\begin_preamble
\usepackage[breaklinks,colorlinks=true,linkcolor=blue,
citecolor=blue, urlcolor=blue]{hyperref}
\usepackage{braket}
\usepackage{mathtools}
\DeclarePairedDelimiter\abs{\lvert}{\rvert}%
\DeclarePairedDelimiter\norm{\lVert}{\rVert}%
\let\oldnorm\norm
\def\norm{\@ifstar{\oldnorm}{\oldnorm*}}
\makeatother
\usepackage{amsfonts}
\usepackage{dsfont}
\renewcommand{\vec}[1]{\mathbf{#1}}
\usepackage[scaled=0.88]{beraserif}
\usepackage[scaled=0.85]{berasans}
\usepackage[scaled=0.84]{beramono}
\usepackage[T1]{fontenc}
\usepackage{mathpazo}
\usepackage[T1,small,euler-digits]{eulervm}
\end_preamble
\options reqno
\use_default_options true
\begin_modules
theorems-ams
eqs-within-sections
figs-within-sections
theorems-sec
\end_modules
\maintain_unincluded_children false
\begin_local_layout
Preamble
\swapnumbers
EndPreamble
\end_local_layout
\language english
\language_package default
\inputencoding auto
\fontencoding global
\font_roman default
\font_sans default
\font_typewriter default
\font_math auto
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100
\font_tt_scale 100
\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize default
\spacing single
\use_hyperref false
\pdf_bookmarks true
\pdf_bookmarksnumbered false
\pdf_bookmarksopen false
\pdf_bookmarksopenlevel 1
\pdf_breaklinks false
\pdf_pdfborder false
\pdf_colorlinks true
\pdf_backref false
\pdf_pdfusetitle true
\papersize a4paper
\use_geometry true
\use_package amsmath 1
\use_package amssymb 1
\use_package cancel 1
\use_package esint 0
\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
\leftmargin 1cm
\topmargin 1cm
\rightmargin 1cm
\bottommargin 1cm
\secnumdepth 5
\tocdepth 3
\paragraph_separation indent
\paragraph_indentation default
\quotes_language english
\papercolumns 1
\papersides 1
\paperpagestyle default
\bullet 1 0 9 -1
\bullet 3 0 7 -1
\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 Title
Title
\end_layout

\begin_layout Chapter
First Chapter
\end_layout

\begin_layout Section
First Section
\end_layout

\begin_layout Standard
Here is some text.
 As it begins a paragraph, it starts indented.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
\end_layout

\begin_layout Claim
Some Claim [some words some words some words some words some words some
 words some words some words some words some words some words some words
 some words some words some words some words some words some words some
 words some words some words some words some words some words]
\end_layout

\begin_layout Definition
Some Definition
\end_layout

\end_body
\end_document

以及以下导出的 .tex 文件:

#LyX 2.2 created this file. For more info see http://www.lyx.org/
\lyxformat 480
\begin_document
\begin_header
\textclass amsbook
\begin_preamble
\usepackage[breaklinks,colorlinks=true,linkcolor=blue,
citecolor=blue, urlcolor=blue]{hyperref}
\usepackage{braket}
\usepackage{mathtools}
\DeclarePairedDelimiter\abs{\lvert}{\rvert}%
\DeclarePairedDelimiter\norm{\lVert}{\rVert}%
\let\oldnorm\norm
\def\norm{\@ifstar{\oldnorm}{\oldnorm*}}
\makeatother
\usepackage{amsfonts}
\usepackage{dsfont}
\renewcommand{\vec}[1]{\mathbf{#1}}
\usepackage[scaled=0.88]{beraserif}
\usepackage[scaled=0.85]{berasans}
\usepackage[scaled=0.84]{beramono}
\usepackage[T1]{fontenc}
\usepackage{mathpazo}
\usepackage[T1,small,euler-digits]{eulervm}
\end_preamble
\options reqno
\use_default_options true
\begin_modules
theorems-ams
eqs-within-sections
figs-within-sections
theorems-sec
\end_modules
\maintain_unincluded_children false
\begin_local_layout
Preamble
\swapnumbers
EndPreamble
\end_local_layout
\language english
\language_package default
\inputencoding auto
\fontencoding global
\font_roman default
\font_sans default
\font_typewriter default
\font_math auto
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100
\font_tt_scale 100
\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize default
\spacing single
\use_hyperref false
\pdf_bookmarks true
\pdf_bookmarksnumbered false
\pdf_bookmarksopen false
\pdf_bookmarksopenlevel 1
\pdf_breaklinks false
\pdf_pdfborder false
\pdf_colorlinks true
\pdf_backref false
\pdf_pdfusetitle true
\papersize a4paper
\use_geometry true
\use_package amsmath 1
\use_package amssymb 1
\use_package cancel 1
\use_package esint 0
\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
\leftmargin 1cm
\topmargin 1cm
\rightmargin 1cm
\bottommargin 1cm
\secnumdepth 5
\tocdepth 3
\paragraph_separation indent
\paragraph_indentation default
\quotes_language english
\papercolumns 1
\papersides 1
\paperpagestyle default
\bullet 1 0 9 -1
\bullet 3 0 7 -1
\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 Title
Title
\end_layout

\begin_layout Chapter
First Chapter
\end_layout

\begin_layout Section
First Section
\end_layout

\begin_layout Standard
Here is some text.
 As it begins a paragraph, it starts indented.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
 Bla bla bla.
\end_layout

\begin_layout Claim
Some Claim [some words some words some words some words some words some
 words some words some words some words some words some words some words
 some words some words some words some words some words some words some
 words some words some words some words some words some words]
\end_layout

\begin_layout Definition
Some Definition
\end_layout

\end_body
\end_document

这将导致以下 PDF 输出:

在此处输入图片描述

顺便说一句,如果您有兴趣,订阅 lyx-devel(和 lyx-users)会更好。我们列表中的大多数人都使用 Linux,因此如果能从使用 Mac 上 LyX 开发版的人那里得到反馈就更好了。有关更多信息,请参见此处: http://www.lyx.org/MailingLists

相关内容