我正在使用 LyX,并希望对章节中的示例、定义和定理进行这样的结束标记:
Theorem 1.1 Statement......
Definition 1.1 Statement......
Example 1.1 Statement......
Example 1.2 Statement......
Definition 1.2 Statement......
我在 LyX 中的 LaTex 序言是:
\documentclass[12pt,oneside,english]{book}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{geometry}
\geometry{verbose,tmargin=4cm,bmargin=4cm,lmargin=4cm,rmargin=2cm}
\pagestyle{plain}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}
\setlength{\parindent}{40bp}
\usepackage{color}
\usepackage{babel}
\usepackage{array}
\usepackage{bm}
\usepackage{multirow}
\usepackage{amsthm}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{setspace}
\usepackage[authoryear]{natbib}
\doublespacing
\usepackage[unicode=true,pdfusetitle,
bookmarks=true,bookmarksnumbered=false,bookmarksopen=false,
breaklinks=false,pdfborder={0 0 1},backref=false,colorlinks=true]
{hyperref}
\hypersetup{
linkcolor=black,citecolor=black,urlcolor=blue,filecolor=blue,pdfpagelayout=OneColumn,pdfnewwindow=true,pdfstartview=XYZ,plainpages=false,pdfpagelabels,citecolor=blue,linkcolor=blue}
\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
%% Because html converters don't know tabularnewline
\providecommand{\tabularnewline}{\\}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands.
\theoremstyle{definition}
\ifx\thechapter\undefined
\newtheorem{example}{\protect\examplename}
\else
\newtheorem{example}{\protect\examplename}[chapter]
\fi
\theoremstyle{plain}
\ifx\thechapter\undefined
\newtheorem{fact}{\protect\factname}
\else
\newtheorem{fact}{\protect\factname}[chapter]
\fi
\theoremstyle{definition}
\ifx\thechapter\undefined
\newtheorem{defn}{\protect\definitionname}
\else
\newtheorem{defn}{\protect\definitionname}[chapter]
\fi
\theoremstyle{plain}
\ifx\thechapter\undefined
\newtheorem{thm}{\protect\theoremname}
\else
\newtheorem{thm}{\protect\theoremname}[chapter]
\fi
\@ifundefined{date}{}{\date{}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usepackage[T1]{fontenc}
\usepackage{geometry}
\geometry{verbose,tmargin=3cm,bmargin=3cm,lmargin=3cm,rmargin=3cm}
\usepackage{babel}
\usepackage{hyperref}
\hypersetup{colorlinks=true,citecolor=blue, linkcolor=blue}
\usepackage{graphicx,epstopdf}
\usepackage{amsmath}
\usepackage[toc,page]{appendix}
\usepackage{bm}
\usepackage{tocloft,calc}
\renewcommand{\cftchappresnum}{Chapter } \AtBeginDocument{\addtolength\cftchapnumwidth{\widthof{\bfseries Chapter }}}
\setlength{\cftafterloftitleskip}{12pt} % list of figures
\setlength{\cftafterlottitleskip}{12pt} % list of tables
\setlength{\cftaftertoctitleskip}{12pt} % table of contents
\usepackage{titlesec}
\titlespacing*{\chapter}{0pt}{-50pt}{20pt}
\titleformat{\chapter}[display]{\normalfont\huge\bfseries}{\chaptertitlename\ \thechapter}{20pt}{\Huge}
\usepackage{tikz}
\usetikzlibrary{matrix,decorations.pathreplacing, calc, positioning}
\usepackage{enumerate}
\usepackage[format=plain,labelfont=bf,up,textfont=it,up]{caption}
\usepackage{amssymb}
\usepackage{thmtools}
\declaretheorem[style=definition,qed=$\blacksquare$,numberwithin=chapter]{definition}
\makeatother
\providecommand{\definitionname}{Definition}
\providecommand{\examplename}{Example}
\providecommand{\factname}{Fact}
\providecommand{\theoremname}{Theorem}
\begin{document}
Text
\end{document}
非常感谢您的帮助来解决这个问题。谢谢
答案1
接受一些指导表示例子/评论的结束,对类定理环境使用以下定义:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands.
\theoremstyle{definition}
\ifx\thechapter\undefined
\newtheorem{examplex}{\protect\examplename}
\else
\newtheorem{examplex}{\protect\examplename}[chapter]
\fi
\newenvironment{example}
{\pushQED{\qed}\renewcommand{\qedsymbol}{$\triangle$}\examplex}
{\popQED\endexamplex}
\theoremstyle{plain}
\ifx\thechapter\undefined
\newtheorem{factx}{\protect\factname}
\else
\newtheorem{factx}{\protect\factname}[chapter]
\fi
\newenvironment{fact}
{\pushQED{\qed}\renewcommand{\qedsymbol}{$\blacksquare$}\factx}
{\popQED\endfactx}
\theoremstyle{definition}
\ifx\thechapter\undefined
\newtheorem{defnx}{\protect\definitionname}
\else
\newtheorem{defnx}{\protect\definitionname}[chapter]
\fi
\newenvironment{defn}
{\pushQED{\qed}\renewcommand{\qedsymbol}{$\Box$}\defnx}
{\popQED\enddefnx}
\theoremstyle{plain}
\ifx\thechapter\undefined
\newtheorem{thmx}{\protect\theoremname}
\else
\newtheorem{thmx}{\protect\theoremname}[chapter]
\fi
\newenvironment{thm}
{\pushQED{\qed}\renewcommand{\qedsymbol}{$\circ$}\thmx}
{\popQED\endthmx}
每个类定理环境都是通过\newtheorem{<env>x}
定义辅助环境<env>x
来定义的,主环境<env>
是<env>x
用适当的QED符号(或结束标记)调用的。
使用上述定义,您的结束标记如下所示:
\documentclass{book}
\usepackage{amsthm}% http://ctan.org/pkg/amsthm
\usepackage{amssymb}% http://ctan.org/pkg/amssymb
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands.
\theoremstyle{definition}
\ifx\thechapter\undefined
\newtheorem{examplex}{\protect\examplename}
\else
\newtheorem{examplex}{\protect\examplename}[chapter]
\fi
\newenvironment{example}
{\pushQED{\qed}\renewcommand{\qedsymbol}{$\triangle$}\examplex}
{\popQED\endexamplex}
\theoremstyle{plain}
\ifx\thechapter\undefined
\newtheorem{factx}{\protect\factname}
\else
\newtheorem{factx}{\protect\factname}[chapter]
\fi
\newenvironment{fact}
{\pushQED{\qed}\renewcommand{\qedsymbol}{$\blacksquare$}\factx}
{\popQED\endfactx}
\theoremstyle{definition}
\ifx\thechapter\undefined
\newtheorem{defnx}{\protect\definitionname}
\else
\newtheorem{defnx}{\protect\definitionname}[chapter]
\fi
\newenvironment{defn}
{\pushQED{\qed}\renewcommand{\qedsymbol}{$\Box$}\defnx}
{\popQED\enddefnx}
\theoremstyle{plain}
\ifx\thechapter\undefined
\newtheorem{thmx}{\protect\theoremname}
\else
\newtheorem{thmx}{\protect\theoremname}[chapter]
\fi
\newenvironment{thm}
{\pushQED{\qed}\renewcommand{\qedsymbol}{$\circ$}\thmx}
{\popQED\endthmx}
\providecommand{\definitionname}{Definition}
\providecommand{\examplename}{Example}
\providecommand{\factname}{Fact}
\providecommand{\theoremname}{Theorem}
\begin{document}
\begin{example}Here is an example.\popQED\end{example}
\begin{fact}Here is a fact.\end{fact}
\begin{defn}Here is a definition.\end{defn}
\begin{thm}Here is a theorem.\end{thm}
\end{document}
特定于 LyX (2.0.4),将文档类设置为book
:
然后将之前的所有内容都包含\begin{document}
在LaTeX 序言:
然后,您的 LyX 文档:
完全不同的是:您需要清理您的LaTeX序言...您多次加载了多个包:fontenc
,,,...这根本没有必要。geometry
hyperref