我正在写书籍课,碰巧书名比较长,当我写的时候,我得到了这个:
我会把标题稍微提高一点,但简短的标题仍然保留
但简短的标题仍然保留,提前致谢:)
代码的重点在这里:
\documentclass[10pt]{book}
\usepackage[latin1]{inputenc}
\usepackage[total={5.2in,9.73in},top=1in, left=1.2in,includefoot]{geometry}
\usepackage{lipsum}
\RequirePackage{fourier} % Fuente palatino
\RequirePackage{pstricks}
\RequirePackage{titlesec}
\newcommand{\hsp}{\hspace{12pt}}
\titleformat{\chapter}[hang]{\huge\bfseries}{{
\fontsize{4.1em}{4.1em}\selectfont\black
\thechapter}\hsp\textcolor{cyan}{\vrule height 2.7em width 1pt}\hsp}{0pt}{\Huge\bfseries}
\begin{document}
\setcounter{chapter}{12}
\chapter{Leyes generales de conservación y simetrías}\lipsum[1-4]
\setcounter{chapter}{16}
\chapter{Teoría de Hamilton-Jacobi}\lipsum[1-4]
\end{document}
答案1
您可以在标题的底行对齐:
\documentclass{report}
\usepackage{color,lmodern,titlesec}
\newcommand\chptitle[1]{\parbox[b]{\dimexpr\textwidth-87pt}{\raggedright#1}}
\newcommand{\hsp}{\hspace{12pt}}
\titleformat{\chapter}[hang]{\huge\bfseries}{{
\fontsize{4.1em}{4.1em}\selectfont\color{black}%
\thechapter}\hsp\textcolor{blue}{\vrule height 2.7em width 1pt}\hsp}{0pt}{\Huge\bfseries\chptitle}
\begin{document}
\chapter{Aaaa bbbb}
aa
\chapter{Aaaa bbbb Aaaa bbbb Aaaa bbbb}
bb
\end{document}