![Titlesec:右侧章节编号](https://linux22.com/image/363209/Titlesec%EF%BC%9A%E5%8F%B3%E4%BE%A7%E7%AB%A0%E8%8A%82%E7%BC%96%E5%8F%B7.png)
我用来 titlesec
个性化部分名称。这是我的代码:
\newcommand{\hsp}{\hspace{20pt}}
\titleformat{\chapter}[hang]{\huge\bfseries\scshape\itshape}
{\thechapter\hsp}{0pt}{\huge\bfseries\scshape}
我想把章节编号放在右边,用 书写itshape
,并使其比现在更大。
完全兼容代码:
\documentclass[11pt,a4paper,twoside,openright,titlepage]{book}
\usepackage[suftesi]{frontespizio}
\usepackage{lipsum}
\newcommand{\hsp}{\hspace{20pt}}
\titleformat{\chapter}[hang]{\huge\bfseries\scshape\itshape}
{\thechapter\hsp}{0pt}{\huge\bfseries\scshape}
\begin{document}
\chapter{Hello}
\lipsum[1]
\end{document}
答案1
玩一下这个(但我并不喜欢这个结果)。
\documentclass[11pt,a4paper,twoside,openright,titlepage]{book}
\usepackage{titlesec}
\usepackage{lmodern}
\usepackage{lipsum}
\titleformat{\chapter}[display]
{\Large\scshape}
{}
{0pt}
{\numberatright}
\titleformat{name=\chapter,numberless}[display]
{\Large\scshape}
{}
{0pt}
{\zarchaptertitle}
\newcommand{\zarchaptertitle}[1]{%
\parbox[t]{0.8\textwidth}{#1}
}
\newcommand{\numberatright}[1]{%
\zarchaptertitle{#1}\hfill
\makebox[0pt][r]{\fontsize{48}{0}\itshape\thechapter}%
}
\begin{document}
\frontmatter
\tableofcontents
\mainmatter
\chapter{Hello}
\lipsum[1]
\end{document}
答案2
这应该可以解决问题:
\documentclass[11pt,a4paper,twoside,openright,titlepage]{book}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[suftesi]{frontespizio}
\usepackage[showframe]{geometry}
\usepackage{titlesec}
\usepackage{lipsum}
\newcommand{\hsp}{\hspace{20pt}}
\titleformat{\chapter}[block]{\huge\bfseries\scshape\filcenter}
{\makebox[0pt]{\makebox[\textwidth][r]{\scalebox{2}{\itshape\thechapter}\hsp}}}{0pt}{}
\begin{document}
\chapter{Hello}
\lipsum[1]
\end{document}