在写论文的某个时候,我从章节标题中删除了数字,现在我找不到删除数字的行。我想让数字/字母重新出现在那里。抱歉,这不是一个可行的例子。
我怀疑错误出在
\titleformat{\chapter}[hang]
{\normalfont\huge\filcenter\bfseries}
{\thechapter}
{0.5em}
{}
,因为它打印的是 chapter 的默认样式带有编号如果我删除它。我以为 \thechapter 也会打印数字(在我的情况下是字母),但在我的情况下它没有这样做。如果我想在那里显示数字,该行的正确表达式是什么?
这是文档
\documentclass[10pt,a4paper]{book}
\usepackage{graphicx}
\usepackage{polyglossia}
\setmainlanguage[spelling=new,babelshorthands=true]{german}
%\usepackage[utf8]{inputenc}
\usepackage[autostyle]{csquotes}
\MakeOuterQuote{"}
\MakeInnerQuote{|}
\usepackage[pass]{geometry}
\setlength{\headheight}{15pt}
\usepackage{setspace}
\setstretch{1.5}
\setlength{\parindent}{5mm}
\usepackage{fancyhdr}
\makeatletter
\newcommand{\resetHeadWidth}{\fancy@setoffs}
\makeatother
\usepackage[bottom,hang]{footmisc}
\setlength\footnotemargin{15pt} % align footnote text for multiline footnotes
\renewcommand{\footnoterule}{%
\kern -3pt
\hrule width \textwidth height 0.5pt
\kern 2pt
}
\usepackage{fontspec}
\defaultfontfeatures{Ligatures=TeX}
\setmainfont{Linux Biolinum O}
%[BoldFont = {Caecilia LT Std},
%ItalicFont = {Caecilia LT Std}]
%\setmonofont[Color={000000}]{Inconsolata}
%\setromanfont{Times New Roman}
%\setsansfont{Arial}
%\setmonofont[Color={000000}]{Courier New}
%\renewcommand{\acsfont}[1]{\textsc{#1}}
\usepackage{tocloft}
\usepackage[chapter,nottoc]{tocbibind} %index in table of contents
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% section chapter style global
\renewcommand{\thesection}{\arabic{section}}
\makeatletter
\renewcommand{\p@section}{\thechapter.}
\makeatother
\renewcommand\thechapter{\Alph{chapter}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% styling of headings
\usepackage[raggedright,nobottomtitles]{titlesec}
\titleformat{\paragraph}[hang]{\normalfont\normalsize\bfseries}{\theparagraph}{1em}{}
\titlespacing*{\paragraph}{0pt}{3.25ex plus 1ex minus .2ex}{0.5em}
\setlength{\cftbeforetoctitleskip}{-5em}
\titleformat{\chapter}[hang]
{\normalfont\huge\filcenter\bfseries}
{\thechapter}
{0.5em}
{}
%\titlelabel{\thetitle\quad}
\titlespacing*{\chapter}{0pt}{-50pt}{20pt}
\titleformat{\section}[hang]{\normalfont\LARGE\itshape\bfseries}{\thesection}{0.5em}{}
\titleformat{\subsection}[hang]{\normalfont\Large\itshape\bfseries}{\thesubsection}{0.5em}{}
\titleformat{\subsubsection}[hang]{\normalfont\large\itshape\bfseries}{\thesubsubsection}{0.5em}{}
\titleformat{\paragraph}[hang]{\normalfont\normalsize\itshape\bfseries}{\theparagraph}{0.5em}{}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% bibliography and citation styling
\usepackage[style=authortitle-dw,
edsuper=true,
namefont=smallcaps,
useprefix=true,
ibidemfont=smallcaps,
idemfont=smallcaps,
idembibformat=dash,
shorthandibid=true,
backref=false,
backrefstyle=none,
hyperref=true,
isbn=false,
backend=biber,
citereset=chapter,
bibencoding=utf8]{biblatex}
%\renewcommand*{\mkbibnamelast}[1]{\textsc{#1}}
%\renewcommand*{\mkbibnamefamily}[1]{\textsc{#1}}
\DeclareFieldFormat{pages}{#1}
\DeclareFieldFormat{page}{#1}
\DeclareNameAlias{sortname}{last-first}
\DeclareFieldFormat{postnote}{#1}
% all authors should be separated by slashes
\renewcommand*{\multinamedelim}{\addnbspace\slash\space}
%\renewcommand*{\finalnamedelim}{\addnbspace\slash\space}
\renewcommand*{\bibmultinamedelim}{\addnbspace\slash\space}
%\renewcommand*{\bibfinalnamedelim}{\addnbspace\slash\space}
% the separator before the location should be a dot, not a comma
\renewbibmacro*{publisher+location+date}{%
\setunit{\addperiod\space}%
\printlist{location}%
\iflistundef{publisher}
{\setunit*{\addcomma\space}}
{\setunit*{\addcolon\space}}%
\printlist{publisher}%
\setunit*{\addcomma\space}%
\usebibmacro{date}%
\newunit}
\DefineBibliographyStrings{german}{
and={/},
andothers = {{et\,al\adddot}},
byeditor = {{herausgegeben von}{hg\adddot\addabthinspace v\adddot}},
byeditortr = {{herausgegeben und \lbx@lfromlang \"ubersetzt von}%
{hg\adddotspace und \lbx@sfromlang \"ubers\adddot\ v\adddot}},
byeditorco = {{herausgegeben und kommentiert von}%
{hg\adddotspace und komm\adddot\ v\adddot}},
byeditoran = {{herausgegeben und erl\"autert von}%
{hg\adddotspace und erl\"aut\adddot\ v\adddot}},
byeditorin = {{herausgegeben und mit einer Einleitung versehen von}%
{hg\adddotspace und mit einer Einl\adddot\ vers\adddot\ v\adddot}},
byeditorfo = {{herausgegeben und mit einem Vorwort versehen von}%
{hg\adddotspace und mit einem Vorw\adddot\ vers\adddot\ v\adddot}},
byeditoraf = {{herausgegeben und mit einem Nachwort versehen von}%
{hg\adddotspace und mit einem Nachw\adddot\ vers\adddot\ v\adddot}},
byeditortrco = {{herausgegeben, \lbx@lfromlang \"ubersetzt und kommentiert von}%
{hg., \lbx@sfromlang \"ubers\adddot\ und komm\adddot\ v\adddot}},
byeditortran = {{herausgegeben, \lbx@lfromlang \"ubersetzt und erl\"autert von}%
{hg., \lbx@sfromlang \"ubers\adddot\ und erl\"aut\adddot\ v\adddot}},
byeditortrin = {{herausgegeben, \lbx@lfromlang \"ubersetzt und mit einer Einleitung versehen von}%
{hg., \lbx@sfromlang \"ubers\adddot\ und mit einer Einl\adddot\ vers\adddot\ v\adddot}},
byeditortrfo = {{herausgegeben, \lbx@lfromlang \"ubersetzt und mit einem Vorwort versehen von}},
editor = {{Hg\adddot}},
editors = {{Hg\adddot}}
}
\usepackage{url}
\setcounter{biburllcpenalty}{9000}
\setcounter{biburlucpenalty}{9000}
\setcounter{biburlnumpenalty}{9000}
% make title italic
%\renewbibmacro*{cite:title}{\ifsingletitle
% {\setunit{}}% Löschen des \nametitledelim, falls kein Titel ausgegeben wird
% {\ifboolexpr{
% test {\ifentrytype{review}}
% and
% not test {\iffieldundef{xref}}
% }
% {\printtext[review]{\bbx@review{\thefield{xref}}}}
% {\printtext[bibhyperref]{%
% \printfield[citetitle]{labeltitle}}}%
% \ifbool{cbx:addyear}
% {\iffieldundef{year}
% {}
% {\titleyeardelim\parentext{\printfield{year}}}}{}}}
\usepackage[withpage]{acronym}
\usepackage{relsize}
\usepackage{xargs} % Use more than one optional parameter in a new commands
\usepackage[dvipsnames]{xcolor} % Coloured text etc.
\usepackage[colorinlistoftodos,prependcaption,textsize=tiny]{todonotes}
\newenvironment{indentt}{\begin{list}{}%
{\setlength{\leftmargin}{0.5cm}}%
\item[]}{\end{list}}
\defbibheading{caption}{
\phantomsection
\addcontentsline{toc}{section}{#1}
\section*{#1}%
\markboth{#1}{#1}
}
\usepackage[bookmarks]{hyperref}
\hypersetup{hidelinks}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% multind fuer andere Register
\usepackage{multicol}
\usepackage{multind}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% glossaries fuer Personenregister
\usepackage[nopostdot,toc,section]{glossaries}
\glsaddkey*% star version needed as default value needs expanding
{nn}% key
{\glsentrytext{\glslabel}nn}% default value
{\glsentrynn}% command analogous to \glsentrytext
{\Glsentrynn}% command analogous to \Glsentrytext
{\glsnn}% command analogous to \glstext
{\Glsnn}% command analogous to \Glstext
{\GLSnn}% command analogous to \GLStext
\glsaddkey*% star version needed as default value needs expanding
{fn}% key
{\glsentrytext{\glslabel}fn}% default value
{\glsentryfn}% command analogous to \glsentrytext
{\Glsentryfn}% command analogous to \Glsentrytext
{\glsfn}% command analogous to \glstext
{\Glsfn}% command analogous to \Glstext
{\GLSfn}% command analogous to \GLStext
\newcommand*{\entryurl}[1]{%
\glsdoifexists{#1}%
{%
\glsletentryfield{\thisurl}{#1}{useri}%
\expandafter\url\expandafter{\thisurl}%
}%
}
\newglossarystyle{urls}
{% based on list style
\setglossarystyle{list}%
\renewcommand{\glossentry}[2]{%
\item[\glsentryitem{##1}%
\glstarget{##1}{\glossentryname{##1}}]
\glspostdescription \hfill##2\qquad\qquad%
\\
\glossentrydesc{##1}}
}
\makeglossaries
\loadglsentries{person-glossary}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% new commands
\newcommand{\id}[1]{#1\,\index{#1}}
\newcommand{\z}[3]{\footcite[#3][#2]{#1}}
\newcommand{\q}[1]{\enquote{#1}}
\newcommand{\be}[1]{#1\index{begriffe}{#1}}
\newcommand{\beg}[2]{#1\index{begriffe}{#2}}
\newcommand{\ibe}[1]{\index{begriffe}{#1}}
\newcommand{\p}[1]{#1\index{personen}{#1}}
\newcommand{\pe}[2]{#1\index{personen}{#2}}
\newcommand{\bib}[1]{#1\index{bibelstellen}{#1}}
\newcommand{\ibib}[1]{\index{bibelstellen}{#1}}
\newcommand{\bibe}[2]{#1\index{bibelstellen}{#2}}
\newcommandx{\imp}[2][1=]{\todo[linecolor=red,backgroundcolor=red!25,bordercolor=red,#1]{#2}}
\renewcommand*{\citenamepunct}{\addcomma\space} % in fussnoten komma hinter dem autor
\renewcommand*{\locationpublisherpunct}{\adddot\space}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% pagestyle
\pagestyle{fancyplain}
\renewcommand{\chaptermark}[1]{\markboth{\ifnum\value{chapter}=0 \thechapter\else\thechapter.\fi\ #1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection.\ #1}}
\lhead[\fancyplain{}{\bfseries\thepage}]{\fancyplain{}{\bfseries\rightmark}}
\rhead[\fancyplain{}{\bfseries\leftmark}]{\fancyplain{}{\bfseries\thepage}}
\cfoot{}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% table of contents styling
\usepackage{titletoc}
\setcounter{tocdepth}{4}
\setcounter{secnumdepth}{3}
\titlecontents*{paragraph}[7.5em]{\small}{\thecontentslabel}{}{~(\thecontentspage)}[~---\ ]
%\titlecontents{section}[3.8em]{}{\contentslabel{2.3em}}{\hspace*{-2.3em}}{\titlerule*[1pc]{.}\contentspage}
\hyphenation{Mit-tel-stre-cken-ra-ke-ten Ver-ei-ni-gung Lu-xem-burg Lan-des-vor-sitz-en-der Meck-len-burg-Vor-pom-mern Weih-nach-ten Aus-ein-an-der-setz-ung Ver-ant-wort-ung Kom-mu-nis-ti-schen So-w-jet-uni-on hun-der-te Stell-ver-tre-ter}
\makeindex{begriffe}
%\makeindex{personen}
\makeindex{bibelstellen}
\addbibresource{literatur.bib}
\addbibresource{predigten.bib}
\addbibresource{quellen.bib}
\addbibresource{lexika.bib}
\addbibresource{unverquellen.bib}
\begin{document}
\frontmatter
\newgeometry{inner=2cm,outer=2cm,bottom=2cm,top=3cm}
\resetHeadWidth
\addtocontents{toc}{\protect\sloppy}
\tableofcontents
\addtocontents{toc}{\vskip-10pt}
\markboth{Inhaltsverzeichnis}{Inhaltsverzeichnis}
\mainmatter
\newgeometry{inner=2cm,outer=2cm,bottom=2cm,top=3cm}
\resetHeadWidth
\setcounter{page}{1}
\setlength{\emergencystretch}{1em}
\input{vorwort}
\input{MethodischerTeil}
\input{HistorischerTeil}
\input{DiePredigten}
\input{SystematischerTeil}
\input{wirkungsgeschichte}
\input{glossary}
% \restoregeometry
% \resetHeadWidth
\chapter{Anhang}
\section*{Dokumente}
\begin{figure}[h!]
\includegraphics[width=1.0\textwidth]{tisa}
\caption{Holzschnitt 1/50 mit dem Titel "Wir bleiben hier. Schliesst euch an. Rostock. Oktober '89.", Elisabeth "Tisa" von der Schulenburg}
\label{fig:tisa}
\end{figure}
\pagebreak
\begin{figure}[h!]
\includegraphics[width=1.0\textwidth]{fragebogen}
\caption{Fragebogenvorlage}
\label{fig:fragebogen}
\end{figure}
\pagebreak
% \include{chronologie}
\setlength{\emergencystretch}{3em}
\printbibliography[keyword=unverquellen,title=Verzeichnis der unveröffentlichten Quellen,heading=caption]
\printbibliography[keyword=quellen,title=Quellenverzeichnis,heading=caption]
\printbibliography[keyword=lexika,title=Lexika,heading=caption]
\printbibliography[keyword=literatur,title=Literaturverzeichnis,heading=caption]
\printglossary[style=urls,nopostdot=true,nogroupskip,title=Personenregister,toctitle=Personenregister]
\pagebreak
\printindex{begriffe}{Sachregister}
% \printindex{personen}{Personenregister}
\pagebreak
\printindex{bibelstellen}{Bibelstellenregister}
\pagebreak
\input{predigtanhang}
% \printbibliography
%\include{danksagung}
% ö Ö Ü ü Ä ä
%\include{lebenslauf}
\end{document}
答案1
答案是使用block
选项而不是hang
因此正确的做法是:
\titleformat{\chapter}[block]
{\normalfont\huge\filcenter\bfseries}
{\thechapter}
{0.5em}
{}