一个简单的LaTeX书籍模版

发布于 2023-01-14 19:35:05

参考陆亚明老师编写的《数学分析入门》的排版方式,制作了该模版。

\documentclass[10pt,a4paper]{book}

\title{标题}
\author{}
\date{\today}

\usepackage{ctex} 
\usepackage{geometry,graphicx,xcolor,color}
\usepackage{amssymb,amsmath,amsthm}                             % 数学字体
\usepackage{newpxtext,mathpazo}                                % 采用 Palatino 风格字体
\usepackage{newclude,ulem}
\definecolor{winered}{rgb}{0.5,0,0}
\definecolor{structurecolor}{RGB}{122,122,142}
\definecolor{main}{rgb}{0.5,0,0}
\definecolor{second}{RGB}{115,45,2}
\definecolor{third}{RGB}{0,80,80}
\usepackage[colorlinks,linkcolor = winered]{hyperref}           % 定义引用的颜色


% ------------------------------------------------------------%
% 定义定理环境
\usepackage{amsthm}
\newtheoremstyle{defstyle}{3pt}{3pt}{\kaishu}{-3pt}{
  \bfseries\color{main}}{}{0.5em}{\indent 【\thmname{#1} \thmnumber{#2}】 \thmnote{(#3)}}
\newtheoremstyle{thmstyle}{3pt}{3pt}{\kaishu}{-3pt}{
  \bfseries\color{second}}{}{0.5em}{\indent【\thmname{#1} \thmnumber{#2}】 \thmnote{(#3)}}
\newtheoremstyle{prostyle}{3pt}{3pt}{\kaishu}{-3pt}{
  \bfseries\color{third}}{}{0.5em}{\indent【\thmname{#1} \thmnumber{#2}】 \thmnote{(#3)}}

\theoremstyle{thmstyle} %theorem style
  \newtheorem{theorem}{定理}[chapter]
\theoremstyle{defstyle} % definition style
  \newtheorem{definition}[theorem]{定义}
  \newtheorem{lemma}[theorem]{引理}
  \newtheorem{corollary}[theorem]{推论}
\theoremstyle{prostyle} % proposition style
  \newtheorem{proposition}[theorem]{命题}
  \newtheorem{example}[theorem]{例题}

\renewenvironment{proof}[1][证明]{\par{\kaishu \uline{\textbf{#1.}}} \;\fangsong}{\qed\par}
\newenvironment{solution}{\par\underline{\textbf{解.}} \;\kaishu}{\par}
\newenvironment{remark}{\par\underline{\textbf{注.}} \;\fangsong}{\par}
\newcommand{\intro}[1]{\rightline{\parbox[t]{5cm}{\footnotesize \fangsong\quad\quad #1 }}}
% ------------------------------------------------------------%

\usepackage{enumerate}
\usepackage{enumitem}
\setlist[enumerate,1]{label=\color{structurecolor}\arabic*.}
\setlist[enumerate,2]{label=\color{structurecolor}(\arabic*).}
\setlist[enumerate,3]{label=\color{structurecolor}\Roman*.}
\setlist[enumerate,4]{label=\color{structurecolor}\Alph*.}


% 设置章形式
% ---------------------------------- %
% \setlength{\parindent}{0pt}      
\usepackage{titlesec, titletoc}
\linespread{1.2}                 

\usepackage{fancyhdr}
\fancypagestyle{plain}{%
\fancyhf{} % clear all header and footer fields
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
}

\titlecontents{chapter}[0em]{}{\large \fangsong{第 \thecontentslabel 章\quad}}{}{\hfill\contentspage}
\titlecontents{section}[2em]{}{\thecontentslabel\quad\textcolor{blue}}{}{\titlerule*{ .} \contentspage}

\titleformat{\chapter}[display]{\Large}
    {\color{structurecolor}\centering\small \color{structurecolor}第 \zhnumber{\arabic{chapter}} \ 章 }{0.5ex}
    {\color{structurecolor}{\titlerule[1pt]}\Large \kaishu \centering \bfseries}

\titleformat{\section}[frame]
{\normalfont\color{structurecolor}}
    {\footnotesize \enspace \large \textcolor{structurecolor}{\S \,\thesection}\enspace}{6pt}
    {\Large\filcenter \bf \kaishu }

\titlespacing*{\section}{1pc}{*7}{*2.3}[1pc]
\titleformat{\subsection}[hang]{\bfseries}{
    \large\bfseries\color{structurecolor}\thesubsection\enspace}{1pt}{%
    \color{structurecolor}\large\bfseries\filright}
\titleformat{\subsubsection}[hang]{\bfseries}{
    \large\bfseries\color{structurecolor}\thesubsubsection\enspace}{1pt}{%
    \color{structurecolor}\large\bfseries\filright}



\begin{document}

\maketitle

\newpage
        
\tableofcontents

\setcounter{page}{0}
\thispagestyle{empty}
\newpage
\chapter{集合与映射}

\intro{
    在数学中,严格性不是一切,但是没有它便没有一切。不严格的证明微不足道。

    \rightline{——H.Poincar$\mathrm{\acute{e}}$}
}

\section{集合}

    \begin{definition}
        设\(A, B\)是两个集合,若\(A\)中元素均属于\(B\),则称\(A\)为\(B\)的\uline{子集},记作\(A \subseteq B\)或者\(B \supseteq A\)。此时也称\uline{\(A\)包含于\(B\)},或\uline{\(B\)包含于\(A\)}。若\(A \subseteq B\)且存在\(B\)中的元素不属于\(A\),则称\(A\)为\(B\)的\uline{真子集},记作\(A \subset B\)或者\( B \supset A\)。
    \end{definition}

    \begin{theorem}
        
    \end{theorem}

    \begin{proposition}
        \(( a, b) = (c, d)\)当且仅当\(a = c\) 且\(b = d\)。
    \end{proposition}    

    \begin{proof}
        充分性是显然的。下证明必要性。如果\((a, b) = (c, d)\),那么$$\{\{a\}, \{a, b\} = \{\{c\}, \{c, d\}\}$$
        \begin{enumerate}
            \item 若\(a = b\),则有$$\{\{a \}\} = \{\{c\}, \{c, d\}\}$$那么\(c = d\)否则上式右侧有两个元素。
            \item 若\(a \neq b\),则必有\(c \neq d\),否则左侧有两个元素而右侧有一个元素。而且必有$$\{a\} = \{c\} \qquad \text{且}\qquad \{a, b\} = \{ c, d\}$$进而\(a = c\)且\(b = d\)。
        \end{enumerate}
    \end{proof}

    \begin{solution}

    \end{solution}

\end{document}

image.png

选自:https://zhuanlan.zhihu.com/p/597405787

0 条评论

发布
问题