更改页眉、页脚和章节的样式

更改页眉、页脚和章节的样式

我正在使用撰写论文documentclass book。我想更改页眉和页脚,并稍微修改章节的大小和位置。

现在它看起来差不多是这样的: 在此处输入图片描述 但我想要这样的东西: 在此处输入图片描述

所以我想要的是:

  1. 页码始终位于页面底部的中央
  2. 小写标题
  3. 章节号左对齐,不加粗且较大
  4. 章节标题右对齐、粗体且大小与现在相同。

这是我的序言:

\documentclass[a4paper, 11pt, titlepage]{book}

\usepackage[italian]{babel}
\usepackage{courier}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[nouppercase, swapnames]{frontespizio}
\usepackage[hidelinks]{hyperref} 
\usepackage{alltt}
\usepackage{cancel}
\usepackage{textcomp}
\usepackage{float}
\restylefloat{table}

\usepackage{titlesec}
\titleclass{\subsubsubsection}{straight}[\subsection]
\newcounter{subsubsubsection}[subsubsection]
\renewcommand\thesubsubsubsection{\thesubsubsection.\arabic{subsubsubsection}}
\renewcommand\theparagraph{\thesubsubsubsection.\arabic{paragraph}} % optional; useful if paragraphs are to be numbered

\titleformat{\subsubsubsection}
  {\normalfont\normalsize\bfseries}{\thesubsubsubsection}{1em}{}
\titlespacing*{\subsubsubsection}
{0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}

\makeatletter
\renewcommand\paragraph{\@startsection{paragraph}{5}{\z@}%
  {3.25ex \@plus1ex \@minus.2ex}%
  {-1em}%
  {\normalfont\normalsize\bfseries}}
\renewcommand\subparagraph{\@startsection{subparagraph}{6}{\parindent}%
  {3.25ex \@plus1ex \@minus .2ex}%
  {-1em}%
  {\normalfont\normalsize\bfseries}}
\def\toclevel@subsubsubsection{4}
\def\toclevel@paragraph{5}
\def\toclevel@paragraph{6}
\def\l@subsubsubsection{\@dottedtocline{4}{7em}{4em}}
\def\l@paragraph{\@dottedtocline{5}{10em}{5em}}
\def\l@subparagraph{\@dottedtocline{6}{14em}{6em}}
\makeatother
\setcounter{secnumdepth}{4}
\setcounter{tocdepth}{4}



\newsavebox{\RGbox}
\newcommand{\R}[1]{%
  \begingroup\setlength{\fboxsep}{0pt}%
  \sbox{\RGbox}{\colorbox{lightred}{\vphantom{fg}#1}}%
  \usebox{\RGbox}%
  \makebox[0pt][r]{\vrule width \wd\RGbox height .5ex depth -\dimexpr.5ex-0.4pt\relax}%
  \endgroup
}
\newcommand{\G}[1]{%
  \begingroup\setlength{\fboxsep}{0pt}%
  \sbox{\RGbox}{\colorbox{lightgreen}{\vphantom{fg}#1}}%
  \usebox{\RGbox}%
  \makebox[0pt][r]{\vrule width \wd\RGbox height -\dimexpr\dp\RGbox-0.4pt\relax depth \dp\RGbox}%
  \endgroup
}

\usepackage{amsmath} 
\newtheorem{theorem}{Theorem}[section]
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{corollary}[theorem]{Corollary}


\usepackage{listings} 
\usepackage{fancyvrb}
\usepackage{textcomp}
\usepackage{xcolor}
\definecolor{lightgray}{rgb}{.95,.95,.95}
\definecolor{darkgray}{rgb}{.4,.4,.4}
\definecolor{purple}{rgb}{0.65, 0.12, 0.82}
\definecolor{darkred}{rgb}{0.8, 0.0, 0.0}
\definecolor{darkgreen}{rgb}{0.13, 0.55, 0.13}
\colorlet{lightgreen}{green!30}
\colorlet{lightred}{red!30}
\definecolor{dkgreen}{rgb}{0,0.6,0}
\definecolor{gray}{rgb}{0.5,0.5,0.5}
\definecolor{mauve}{rgb}{0.58,0,0.82}

\lstset{frame=tb,
  language=Python,
  aboveskip=3mm,
  belowskip=3mm,
  showstringspaces=false,
  columns=flexible,
  basicstyle={\small\ttfamily},
  numbers=left,
  numberstyle=\tiny\color{gray},
  keywordstyle=\color{blue},
  commentstyle=\color{dkgreen},
  stringstyle=\color{mauve},
  breaklines=true,
  breakatwhitespace=true,
  mathescape=<false>,
  tabsize=3
}

\lstnewenvironment{pseudocode}
  {\lstset{frame=tb,
  language=Python,
  aboveskip=3mm,
  belowskip=3mm,
  showstringspaces=false,
  columns=flexible,
  basicstyle={\small\ttfamily},
  numbers=left,
  numberstyle=\tiny\color{gray},
  keywordstyle=\color{blue},
  commentstyle=\color{dkgreen},
  stringstyle=\color{mauve},
  breaklines=true,
  breakatwhitespace=true,
  mathescape=<false>,
  tabsize=3
  }}
  {}
\lstnewenvironment{html}
  {\lstset{language=HTML,basicstyle={\ttfamily\small},frame=none, tabsize=3, numbers=none}}
  {}

\usepackage{booktabs} 
\usepackage{array} 
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{R}[1]{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}

\usepackage{graphicx} 
\usepackage{subfig}
\captionsetup[subfigure]{subrefformat=simple,labelformat=simple,listofformat=subsimple}
\renewcommand\thesubfigure{(\alph{subfigure})}
\usepackage{color} 
\usepackage{hyperref}

我知道这有点混乱......抱歉。

我读到我必须使用该包花式高清但我刚开始使用乳胶。有人能帮我吗?

谢谢你!

答案1

这是一个解决方案 titlesec,我用titlesec 术语titleps翻译了您的代码。\(sub)paragraph

\documentclass[a4paper, italian, 11pt, titlepage]{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{courier}
\usepackage{fourier, cabin}
\usepackage{babel}
\usepackage[nouppercase, swapnames]{frontespizio}

\usepackage[pagestyles]{titlesec}
\usepackage{microtype}
\SetTracking[no ligatures={f}]{encoding=*}{20}

 \titleformat{name=\chapter}[display]{\lsstyle}{\filright\Huge\chaptername\enspace \thechapter}{4ex}{\LARGE\bfseries\filleft}%
\titleformat{name=\chapter, numberless}[block]{\lsstyle}{}{0pt}{\bfseries\LARGE\filleft}

\titleclass{\subsubsubsection}{straight}[\subsection]
\newcounter{subsubsubsection}[subsubsection]
\renewcommand\thesubsubsubsection{\thesubsubsection.\arabic{subsubsubsection}}
\titleformat{\subsubsubsection}[hang]{\normalfont\normalsize\bfseries}{\thesubsubsubsection}{1em}{}
\titlespacing*{\subsubsubsection}{0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}

\titleformat{\paragraph}[runin]{\normalfont\normalsize\bfseries}{\thesubsubsubsection.\arabic{paragraph}}{1em}{}
\titleformat{name=\paragraph, numberless}[runin]{\normalfont\normalsize\bfseries}{}{0em}{}
\titlespacing*{\paragraph}{0pt} {3.25ex \@plus1ex \@minus .2ex}{1em}

\titleformat{\subparagraph}[runin]{\normalfont\normalsize\bfseries}{\thesubsubsubsection.\arabic{paragraph}}{1em}{}
\titleformat{name=\subparagraph, numberless}[runin]{\normalfont\normalsize\bfseries}{}{0em}{}
\titlespacing*{\subparagraph}{\parindent} {3.25ex \@plus1ex \@minus .2ex}{1em}

\setcounter{secnumdepth}{4}
\setcounter{tocdepth}{4}

\newpagestyle{mystyle}{%
\sethead[][][\sffamily\small\chaptertitle]{\sffamily\small\sectiontitle}{}{}
\setfoot{}{\sffamily\thepage}{}
\headrule
}
\pagestyle{mystyle}

\usepackage[hidelinks]{hyperref}

\usepackage{lipsum}

\begin{document}

\chapter{Titolo del primo capitolo}
\sffamily
\section{Una prima sezione}

\lipsum[1-12]

\end{document} 

在此处输入图片描述 在此处输入图片描述 在此处输入图片描述

相关内容