如何使用 \rlap 命令并排写入章节标题?

如何使用 \rlap 命令并排写入章节标题?

我试过了,minipage但没有成功

\documentclass{book}
   \usepackage[english]{babel}
   \usepackage[paperwidth=190mm,
               paperheight=230mm,
               textheight=180mm,
               lmargin=30mm,
               rmargin=30mm]{geometry}
   \usepackage{multicol}
   \usepackage[pagestyles,explicit]{titlesec}
   \titleformat{\chapter}[display]
   {\normalfont\large\raggedleft} 
   {\vspace{2mm}\hfill\begin{tabular}{@{}r@{}}
        \bfseries\Large first chapter\hspace{2mm}\\[1.5mm]
        \bfseries\Large{#1}
              \end{tabular}
    \rlap{\rule{30mm}{15mm}}
    }{-15mm}{}{}
 \begin{document}
 \chapter{titulo de capitulo muito longo, mas muito longo mesmo!}
 \begin{center}
 \begin{minipage}{100mm}
   {\itshape introducao ao texto introducao ao texto introducao ao texto introducao ao texto introducao ao texto introducao ao texto introducao ao texto introducao ao texto introducao ao texto introducao ao texto introducao ao texto.}
 \end{minipage}
 \end{center}
 \begin{multicols}{2}
  texto texto texto texto texto texto texto texto texto texto texto texto texto texto texto texto texto texto texto texto texto texto texto texto texto.

  texto texto texto texto texto texto texto texto texto texto texto texto texto texto texto texto texto texto texto texto texto texto texto texto texto texto texto texto texto texto texto texto texto texto texto texto.
    \end{multicols}
    \end{document}

在此处输入图片描述

答案1

只是为了好玩,没有用的东西titlesec。如果有需要,对未编号的章节也需要做类似的事情。

alexandre章节标题

\documentclass[
twocolumn,
openany
]{book}
\usepackage[english]{babel}
\usepackage[
paperwidth=190mm,
paperheight=230mm,
textheight=180mm,
lmargin=30mm,
rmargin=30mm
]{geometry}

\usepackage{fmtcount}
\usepackage{etoolbox}
\tracingpatches
\makeatletter
\apptocmd{\@chapter}{\renewcommand{\chapIntroText}{}}{}{}
\renewcommand\@makechapterhead[1]{%
  \vspace*{50pt}%
  {\setlength{\parindent}{0pt} \raggedleft \normalfont
    \ifnum \c@secnumdepth >\m@ne
      \if@mainmatter
      \Large\bfseries \Ordinalstring{chapter}\space \@chapapp
        \par\nobreak
      \fi
    \fi
    \interlinepenalty\@M
    \Large \bfseries #1\smash{\rlap{\hspace{1em}\rule{3cm}{1.5cm}}}\par\nobreak
    \begin{center}
    \begin{minipage}{.8\textwidth}
    \normalfont\normalsize\itshape\chapIntroText
    \end{minipage}
    \end{center}
  }
}
  \makeatother
\newcommand{\chapIntroText}{}
\newcommand{\defChapIntro}[1]{\renewcommand{\chapIntroText}{#1}}
\usepackage{blindtext}
\begin{document}
\defChapIntro{We are introducing this chapter here. This chapter is like a zoo, there is a Wombat. Over there is a Capybara. Look, a Mara! Oh, and a Duck is swimming on the pond}
\chapter[surprise chapter]{This is a long chapter title with a little surprise}
\blindtext[4]

%\defChapIntro{This is much shorter}
\chapter{Welcome to Monkey Town, the most fun and crazy town on earth}
\blindtext[4]
\addtocounter{chapter}{5200}
\chapter{Wombat}
\end{document}

相关内容