在创建 \subsubsubsection 后,我在格式化 \paragraph 和 \subparagraph 时遇到了一些问题这里。
正如您在我的代码中看到的,我正在尝试为我的 \paragraph 和 \subparagraph 标题设置这种形状:
A. 段落标题 1° 小段落标题
就我而言,我无法添加“。”和“°”尽管我已经写了这个:
% **************************
% A. --> \paragraph
% **************************
\renewcommand{\theparagraph}{\Alph{paragraph}}
\titleformat{\paragraph}[block]{\fontsize{11}{12} \selectfont}{\fontsize{13}{12} \selectfont \theparagraph. \\}{1em}{}
% **************************
% 1° --> \subparagraph
% **************************
\renewcommand{\thesubparagraph}{\arabic{paragraph}}
\titleformat{\subparagraph}[block] {\bfseries\LARGE}{\thesubparagraph ° \\}{1em}{}
\documentclass[10pt,twoside]{book}
\usepackage{fancyhdr}
\pagestyle{fancy}
\usepackage[T1]{fontenc}
\usepackage{librecaslon}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{titlesec}
\usepackage{supertabular}
\renewcommand{\baselinestretch}{0.7}
% **************************
% **************************
% **************************
% Formatting titles
% **************************
% **************************
% **************************
\setcounter{secnumdepth}{6}
\setcounter{tocdepth}{6}
% **************************
% Function for \part and \chapter titles
% **************************
\newcommand\framethispage[1][1cm]{%
\tikz[overlay,remember picture,line width=0.2pt]
\draw([xshift=(#1),yshift=(-#1)]current page.north west) -- ([xshift=(#1),yshift=(#1)+2mm]current page.south west);%
\tikz[overlay,remember picture,line width=0.2pt]
\draw([xshift=(#1),yshift=(-#1)]current page.north west) -- ([xshift=(-#1)-2mm,yshift=(-#1)]current page.north east);%
}
% **************************
% Livre 1 --> \part
% **************************
\renewcommand{\thepart}{\arabic{part}}
\makeatletter
\def\@part[#1]#2{%
\thispagestyle{empty}
\framethispage[2cm]
\ifnum \c@secnumdepth >\m@ne
\refstepcounter{part}%
\addcontentsline{toc}{part}{\thepart\hspace{1em}#1}%
\else
\addcontentsline{toc}{part}{#1}%
\fi
{\parindent \z@
\interlinepenalty \@M
\normalfont
\ifnum \c@secnumdepth >\m@ne
\vspace{-9.5cm}
\begin{center}
\begin{tikzpicture}[my node/.style={anchor=base,inner sep=0pt}]
\node[my node] (center) {\fontsize{12}{12} \selectfont \text{Livre} \thepart};
\draw($(center.base)+(-1.9cm,-1ex)$) -- ($(center.base)+(+1.9cm,-1ex)$);
\end{tikzpicture}
\end{center}
\par\nobreak
\fi
\begin{center}
\fontsize{18}{12} \selectfont #2
\end{center}
\markboth{}{}\par}
\newpage
\@afterheading}
\makeatother
% **************************
% Partie 1 --> \chapter
% **************************
\makeatletter
\def\@makechapterhead#1{%
\thispagestyle{empty}
\framethispage[2cm]
\vspace{3.3cm}
{\parindent \z@ \raggedright \normalfont
\ifnum \c@secnumdepth >\m@ne
\begin{center}
\begin{tikzpicture}[my node/.style={anchor=base,inner sep=0pt}]
\node[my node] (center) {\fontsize{12}{12} \selectfont \text{Partie} \thechapter};
\draw($(center.base)+(-1.9cm,-1ex)$) -- ($(center.base)+(+1.9cm,-1ex)$);
\end{tikzpicture}
\end{center}
\par\nobreak
\fi
\interlinepenalty\@M
\begin{center}
\fontsize{18}{12} \selectfont #1\par\nobreak
\end{center}
\newpage
}}
\makeatother
% **************************
% TITRE n° --> \section
% **************************
\renewcommand{\thesection}{\arabic{section}}
\titleformat{\section}[block]
{\fontsize{26}{12} \selectfont \filcenter}{\fontsize{13}{12} \selectfont \textsc{Titre}\
\thesection\\\rule{3cm}{0.5pt}\\}{1em}{}
% **************************
% Chapitre n° --> \subsection
% **************************
\renewcommand{\thesubsection}{\arabic{subsection}}
\titleformat{\subsection}[block]
{\fontsize{24}{12} \selectfont\filcenter}{\fontsize{13}{12} \selectfont \textsc{Chapitre}\
\thesubsection\\\rule{3cm}{0.5pt}\\}{1em}{}
% **************************
% Section n° --> \subsubsection
% **************************
\renewcommand{\thesubsubsection}{\arabic{subsubsection}}
\titleformat{\subsubsection}[block] {\sffamily}{SECTION\ \thesubsubsection}{0.3em}{\bfseries\fontsize{14}{12} \selectfont}[\vskip 0.5ex \titlerule]
\titlespacing*{\subsubsection}{0pt}{*4}{*4}
%*****
% I. --> \subsubsubsection
%*****
\titleclass{\subsubsubsection}{straight}[\subsection]
\newcounter{subsubsubsection}[subsubsection]
\renewcommand{\thesubsubsubsection}{\Roman{subsubsubsection}}
\titleformat{\subsubsubsection}[block]{\bfseries \fontsize{12}{12}\selectfont}
{\thesubsubsubsection.}{1em}{}
\titlespacing*{\subsubsubsection}
{0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}
%\titleformat{\paragraph}[block] {\bfseries\LARGE}{\theparagraph.}{1em}{}
\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
% **************************
% A. --> \paragraph
% **************************
\renewcommand{\theparagraph}{\Alph{paragraph}}
\titleformat{\paragraph}[block]{\fontsize{11}{12} \selectfont}{\fontsize{13}{12} \selectfont \theparagraph. \\}{1em}{}
% **************************
% 1° --> \subparagraph
% **************************
\renewcommand{\thesubparagraph}{\arabic{paragraph}}
\titleformat{\subparagraph}[block] {\bfseries\LARGE}{\thesubparagraph \text{°}}{1em}{}
%*****
% Définition du compteur
%*****
\newcounter{subpara}
\newcommand\numsubpara[1]{\par\refstepcounter{subpara} \thesubpara\text{.}\textbf{\space#1\space}\\}
\begin{document}
\chapter{Test}
\section{Test}
\subsection{Test}
\subsubsubsection{Test}
\subsubsubsection{Test}
\paragraph{Test}
\subparagraph{Test}
\numsubpara{Test}
\end{document}
结果如下: