使用 \titleformat 将文本换行到多行

使用 \titleformat 将文本换行到多行

我正在尝试重现此章节标题:

钾

目前它看起来像这样:

在此处输入图片描述

我正在使用此代码来生成标题:

\documentclass[12pt]{book}
\usepackage{fullpage}
\usepackage{titlesec}
\usepackage{totcount}

% Chapter headers

\regtotcounter{chapter}
\titleformat{\chapter}[hang]{\rmfamily\bfseries\fontsize{62pt}{62}\selectfont}{\huge\ttfamily{\thechapter \\ / \\ 26}}{1em}{}

\begin{document}

\chapter{Finding the Leaks in Your Funnel}
{\leftskip=0pt\relax
 \rightskip=0pt\relax
 You've found PMF. Reduce friction before attempting to scale user acquisition. Use the techniques below to \textbf{find (and address) the leaks in your funnel}. \newline \par}
{\leftskip=3pt\relax
 \rightskip=60pt\relax
{\fontsize{15}{20}\selectfont
\noindent
“The much bigger share of the total addressable market\index{Total Addressable Market} comes from getting people to change what they are doing today, overcoming natural human and organizational inertia.” \newline \par} 
\noindent {\fontsize{9}{12}\selectfont \texttt{Bill Aulet\index{Bill Aulet}\newline
Disciplined Entrepreneurship Author\newline\newline}
 \par}} 
\normalfont \noindent
You've found PMF. Your business is growing.\newline\newline
That’s amazing—but unless you invested significant time in optimizing messaging and workflows before PMF (which you shouldn’t have), only customers with a degree of imagination are going to adopt your product.\newline\newline

\end{document}

2个问题:

  1. 我怎样才能让左边的数字适合更窄的列并分成 3 行?
  2. 如何才能防止标题超出页面范围?

答案1

尝试这个。

\documentclass[12pt]{book}
\usepackage{amsmath}
\usepackage{fullpage}
\usepackage{titlesec}
\usepackage{totcount}

% Chapter header

\regtotcounter{chapter}
\titleformat{\chapter}[hang]
  {\raggedright\sffamily\bfseries\fontsize{62}{62}\selectfont}
  {\huge\ttfamily\mdseries
   % magic number 20pt
   \raisebox{20pt}{\smash{\parbox[t]{2em}{\thechapter\\/\\26}}}}
  {0pt}{}
\titlespacing*{\chapter}{0pt}{50pt}{40pt}[40pt]

\begin{document}

\chapter{Finding the Leaks in Your Funnel}

\sffamily
\setlength{\parindent}{0pt}

You've found PMF. Reduce friction before attempting to scale user acquisition. Use the techniques below to \textbf{find (and address) the leaks in your funnel}.\bigskip

{\leftskip=3pt\relax
 \rightskip=60pt\relax
 \fontsize{15}{20}\selectfont
“The much bigger share of the total addressable market\index{Total Addressable Market} comes from getting people to change what they are doing today, overcoming natural human and organizational inertia.” \par} \bigskip

{\fontsize{9}{12}\selectfont \texttt{Bill Aulet\index{Bill Aulet}\newline
Disciplined Entrepreneurship Author}\par}\bigskip


You've found PMF. Your business is growing.\par\bigskip
That’s amazing—but unless you invested significant time in optimizing messaging and workflows before PMF (which you shouldn’t have), only customers with a degree of imagination are going to adopt your product.\newline\newline
\end{document}

在此处输入图片描述

相关内容