将每个新章节的文本从“章”更改为“节”

将每个新章节的文本从“章”更改为“节”

我正在尝试使用我找到的 LaTeX 模板写一份作业。但是,我想更改模板,以便每次\chapter使用命令时标题旁边的文本都是“Section”而不是“Chapter”,因为我认为作业不够大,不能将其命名为“Chapters”。如果您能帮助我做到这一点,我将不胜感激。

如果您需要我的代码,可以在下面找到它。但是,它很长。除了缩进 4 个空格之外,我不知道如何格式化代码,这对于这么大的代码量来说相当累人。

%\RequirePackage[l2tabu, orthodox]{nag} % Old habits die hard
\documentclass[10pt,twoside,b5paper,showtrims]{memoir}
%\RequireXeTeX

% Stock and paper layout
\showtrimsoff
\pagebv
\setlrmarginsandblock{26mm}{20mm}{*}
\setulmarginsandblock{35mm}{30mm}{*}
\setheadfoot{8mm}{10mm}
\setlength{\headsep}{7mm}
\setlength{\marginparwidth}{18mm}
\setlength{\marginparsep}{2mm}

\checkandfixthelayout                 % Check if errors!
\sideparmargin{outer}                 % Put sidemargins in outer position (why the fuck is this option not default by the class?)

% Large environments

\usepackage{listings}                 % Source code printer 
% Symbols
\usepackage{amsmath,amssymb, latexsym} % AMS and other symbols


% Graphics and colors
\usepackage{graphicx}                 % Including graphics and using colours
\usepackage{xcolor}                   % Defined more color names
\usepackage{eso-pic}                  % Watermark and other bag
\usepackage{dtucolors}
\graphicspath{{graphics/}}


% Floating objets, captions and references
\usepackage[noabbrev,nameinlink,capitalise]{cleveref} % Clever references. Options: "fig. !1!" --> "!Figure 1!"
\hangcaption
\captionnamefont{\bfseries}
\subcaptionlabelfont{\bfseries}
\newsubfloat{figure}
\newsubfloat{table}
\letcountercounter{figure}{table}     % Consecutive table and figure numbering
%\usepackage{cite}

% Table of contents (TOC)
\setcounter{tocdepth}{1}              % Depth of table of content
\setcounter{secnumdepth}{2}           % Depth of section numbering
\newcommand{\shorttableofcontents}[2]{
  \newcounter{oldtocdepth}\setcounter{oldtocdepth}{\value{tocdepth}} 
  \let\oldcontentsname\contentsname
  \renewcommand*{\contentsname}{#1}
  \setcounter{tocdepth}{#2}
  \tableofcontents
  \setcounter{tocdepth}{\value{oldtocdepth}}
  \renewcommand*{\contentsname}{\oldcontentsname}
}

% Todos
\usepackage{totcount}                 % For total counting of counters
\usepackage[colorinlistoftodos]{todonotes} % Todonotes package for nice todos
                                           % (disable by option [disable])
\newtotcounter{todocounter}           % Creates counter in todo
\let\oldtodo\todo
\newcommand*{\newtodo}[2][]{\stepcounter{todocounter}\oldtodo[#1]{\thesection~(\thetodocounter)~#2}}
\let\todo\newtodo
\let\oldmissingfigure\missingfigure
\newcommand*{\newmissingfigure}[2][]{\stepcounter{todocounter}\oldmissingfigure[#1]{\thesection~(\thetodocounter)~#2}}
\let\missingfigure\newmissingfigure
\makeatletter
\newcommand*{\mylistoftodos}{% Only show list if there are todos
\if@todonotes@disabled
\else
    \ifnum\totvalue{todocounter}>0
        \markboth{\@todonotes@todolistname}{\@todonotes@todolistname}
        \phantomsection\todototoc
        \listoftodos
    \else
    \fi
\fi
}
\makeatother
\newcommand{\lesstodo}[2][]{\todo[color=green!40,#1]{#2}}
\newcommand{\moretodo}[2][]{\todo[color=red!40,#1]{#2}}

% Prefrontmatter
\newcommand{\prefrontmatter}{\pagenumbering{alph}}

% Chapterstyle
\makeatletter
\makechapterstyle{mychapterstyle}{
    \chapterstyle{default}
    \def\format{\normalfont\sffamily}

    \setlength\beforechapskip{0mm}

    \renewcommand*{\chapnamefont}{\format\LARGE}
    \renewcommand*{\chapnumfont}{\format\fontsize{40}{40}\selectfont}
    \renewcommand*{\chaptitlefont}{\format\fontsize{32}{32}\selectfont}

    \renewcommand*{\printchaptername}{\chapnamefont\MakeUppercase{\@chapapp}}
    \patchcommand{\printchaptername}{\begingroup\color{dtugray}}{\endgroup}
    \renewcommand*{\chapternamenum}{\space\space}
    \patchcommand{\printchapternum}{\begingroup\color{dtured}}{\endgroup}
    \renewcommand*{\printchapternonum}{%
        \vphantom{\printchaptername\chapternamenum\chapnumfont 1}
        \afterchapternum
    }

    % egen ændring
    \renewcommand*{\chaptername}{Section}

    \setlength\midchapskip{1ex}

    \renewcommand*{\printchaptertitle}[1]{\raggedleft \chaptitlefont ##1}
    \renewcommand*{\afterchaptertitle}{\vskip0.5\onelineskip \hrule \vskip1.3\onelineskip}

}
\makeatother
\chapterstyle{mychapterstyle}

% Header and footer
\def\hffont{\sffamily\small}
\makepagestyle{myruled}
\makeheadrule{myruled}{\textwidth}{\normalrulethickness}
\makeevenhead{myruled}{\hffont\thepage}{}{\hffont\leftmark}
\makeoddhead{myruled}{\hffont\rightmark}{}{\hffont\thepage}
\makeevenfoot{myruled}{}{}{}
\makeoddfoot{myruled}{}{}{}
\makepsmarks{myruled}{
    \nouppercaseheads
    \createmark{chapter}{both}{shownumber}{}{\space}
    \createmark{section}{right}{shownumber}{}{\space}
    \createplainmark{toc}{both}{\contentsname}
    \createplainmark{lof}{both}{\listfigurename}
    \createplainmark{lot}{both}{\listtablename}
    \createplainmark{bib}{both}{\bibname}
    \createplainmark{index}{both}{\indexname}
    \createplainmark{glossary}{both}{\glossaryname}
}
\pagestyle{myruled}
\copypagestyle{cleared}{myruled}      % When \cleardoublepage, use myruled instead of empty
\makeevenhead{cleared}{\hffont\thepage}{}{} % Remove leftmark on cleared pages

\makeevenfoot{plain}{}{}{}            % No page number on plain even pages (chapter begin)
\makeoddfoot{plain}{}{}{}             % No page number on plain odd pages (chapter begin)

\setlength\parindent{0pt}

答案1

\documentclass[10pt,twoside,b5paper,showtrims]{memoir}
\usepackage[english]{babel}
\addto\captionsenglish{\renewcommand\chaptername{Section}}
\begin{document}
\chapter{Foo}
\section{bar}
baz
\end{document}

在此处输入图片描述

答案2

\renewcommand{\chaptername}{Section}只在序言中使用(最好)。

\documentclass{memoir}

\let\LaTeXStandardChapterName\chaptername%
\renewcommand{\chaptername}{Section}

\begin{document}


\chapter{And now I am a section}%


\section{I am a true section, but without "Section" }

\end{document}

在此处输入图片描述

相关内容