我需要用字母对附录章节进行编号,并在每个附录章节的开头和目录中的字母前显示“附录”一词。此外,我需要将附录字母格式化为章节编号
我已经尝试了 KOMA 脚本手册和论坛中的几种解决方案,但没有任何效果。
我将 appendixprefix=true 开关放在 \documentclass 中(如手册中所示)但它并没有改变任何东西。
我也尝试过这里建议的解决方案:
无论有无 appendixprefix=true ,它们对我来说都不起作用。
这是我的代码:
\documentclass[chapterprefix=true,appendixprefix=true]{scrbook}
\setcounter{secnumdepth}{0}
\usepackage{xcolor, graphicx}
\usepackage{geometry}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[italian]{babel}
\usepackage{textcomp}
\usepackage{indentfirst}
\usepackage{times}
\usepackage{mathptmx}
\usepackage{setspace}
\doublespacing
\definecolor{chaptergrey}{rgb}{0.7,0.7,0.7}
\let\raggedchapter\raggedleft
\addtokomafont{disposition}{\normalfont}
%\setkomafont{element}{commands}
\setkomafont{title}{\color{cyan}\LARGE}
\setkomafont{chapter}{\color{cyan}\LARGE}
\setkomafont{subtitle}{\color{black}}
\renewcommand*{\chapterformat}{%
\scalebox{3}{\color{cyan}\thechapter}%
}
\begin{document}
\author{}
\subject{Linea Guida}
\title{\textbf{Il trattamento laparoscopico di laparocele e ernie ventrali}}
\subtitle{}
\titlehead{}
\date{Gennaio 2022}
\frontmatter
\maketitle
\tableofcontents
\chapter{Intro}
\mainmatter
\part{Sviluppo della linea guida}
\chapter{one}
\chapter{two}
\part{Quesiti}
\chapter{three}
\chapter{four}
\backmatter
% bibliography, glossary and index would go here.
\appendix
\chapter{AppendixA}
\chapter{AppendixB}
\end{document}
和:
\renewcommand*{\chaptermarkformat}{%
{\chapapp\nobreakspace\thechapter\autodot\enskip}%
我可以在目录中显示“附录”一词(顺便说一下,它和标题之间没有任何空格),但不能在章节的开头显示。
答案1
您必须删除。该命令与标题\backmatter
类似:没有数字!\frontmatter
所以这只是\appendix
。
答案2
以下建议在文档和目录中的附录章节添加前缀:
\documentclass[chapterprefix=true,numbers=noenddot]{scrbook}
\setcounter{secnumdepth}{\chapternumdepth}
\usepackage{xcolor}
\usepackage{graphicx}
\usepackage{geometry}
\usepackage[T1]{fontenc}
\usepackage[italian]{babel}
\usepackage{indentfirst}
%\usepackage{times}
%\usepackage{mathptmx}
\usepackage{newtxtext}
\usepackage{newtxmath}
\usepackage{textcomp}
\usepackage{setspace}
\doublespacing
\definecolor{chaptergrey}{rgb}{0.7,0.7,0.7}
\let\raggedchapter\raggedleft
\addtokomafont{disposition}{\normalfont}
\setkomafont{title}{\color{cyan}}
\setkomafont{chapter}{\color{cyan}\LARGE}
\setkomafont{subtitle}{\color{black}}
\addtokomafont{partnumber}{\color{cyan}}
\renewcommand*{\chapterformat}{\scalebox{3}{\thechapter}}
\AddToHook{cmd/appendix/after}{%
\AddToHook{cmd/chapterformat/before}{\chapapp\nobreakspace}%
\addtocontents{toc}{\appendixtocentry}%
}
\NewDocumentCommand{\appendixtocentry}{}{%
\DeclareTOCStyleEntry[
entrynumberformat=\tocappendixnumber,
dynnumwidth
]{tocline}{chapter}%
}
\NewDocumentCommand{\tocappendixnumber}{m}{%
\appendixname~#1%
}
\begin{document}
\author{}
\subject{Linea Guida}
\title{\textbf{Il trattamento laparoscopico di laparocele e ernie ventrali}}
\date{Gennaio 2022}
\frontmatter
\maketitle
\tableofcontents
\chapter{Intro}
\mainmatter
\part{Sviluppo della linea guida}
\chapter{one}
\chapter{two}
\part{Quesiti}
\chapter{three}
\chapter{four}
%\backmatter% <- remove this!
% bibliography, glossary and index would go here.
\appendix
\chapter{AppendixA}
\chapter{AppendixB}
\end{document}