我想在 、 和 下方放置一个维多利亚风格的装饰物 ( ) ,pgfornament
80
全部居中且大写。下面是我的最小工作示例 (MWE),但装饰物的位置令人沮丧。请帮忙。List of Algorithms
References
Index
\documentclass[a4paper,12pt]{book}
\usepackage[utf8]{inputenc}
\usepackage{lipsum}
\usepackage{algorithm2e}
\usepackage[object=vectorian]{pgfornament}
\usepackage{imakeidx}
\makeindex
\title{Question}
\author{Author}
\date{August 2021}
\begin{document}
\maketitle
\tableofcontents
\clearpage
\addcontentsline{toc}{chapter}{LIST OF ALGORITHMS}
%\centering {\rule{\textwidth}{1pt} \vspace{-1.5cm}}
\renewcommand{\listalgorithmcfname}{\hfill LIST OF ALGORITHMS \hfill}
\begin{center}
\pgfornament[width=4cm]{80}
\end{center}
{%
\let\oldnumberline\numberline%
\renewcommand{\numberline}{\algorithmcfname~\oldnumberline}%
\listofalgorithms
}
\newpage
\chapter{Introduction}
\lipsum[1] \\
\begin{algorithm}[H]
\SetAlgoLined
\KwData{this text}
\KwResult{how to write algorithm with \LaTeX2e }
initialization\;
\While{not at end of this document}{
read current\;
\eIf{understand}{
go to next section\;
current section becomes this one\;
}{
go back to the beginning of current section\;
}
}
\caption{How to write algorithms}
\end{algorithm}
\section{BibTex}
This document is an example of BibTeX using in bibliography management. Three items
are cited: \textit{The \LaTeX\ Companion} book \cite{latexcompanion}, the Einstein
journal paper \cite{einstein}, and the Donald Knuth's website \cite{knuthwebsite}.
The \LaTeX\ related items are \cite{latexcompanion,knuthwebsite}.
\index{Einstein}
\medskip
\renewcommand{\bibname}{ REFERENCES }
\bibliographystyle{unsrt}
\bibliography{ref}
\printindex
\end{document}
答案1
您可能希望使用该titlesec
包来设计您的无数\chapter
标题;参见例如Titlesec 用于无数命令
因此你可以尝试这样的方法:
% Load the titlesec package
\usepackage{titlesec}
% Styling numberless chapter headings
\titleformat{name=\chapter,numberless}
{\Huge\bfseries}
{}{0pt}
{\filcenter\MakeUppercase}
[{\filcenter\pgfornament[width=4cm]{80}}]
% But you'll need to provide for numberred headings too; so
% here I'm just using the default style
\titleformat{name=\chapter}[display]
{\Huge\bfseries}
{\chaptername~\thechapter}{\baselineskip}
{}
(在您的代码中,应该删除\\
之后的部分)\lipsum[1]