8

I'm working on book class and happen to have a relatively long title, when I write I get this: enter image description here

I would go up a bit the title, but that short titles remain in place

enter image description here

enter image description here but that short titles remain in place, thanks in advance :)

enter image description here

The important thing of the code is here:

\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}
4
  • Hi, it would be more convenient for helpers if you would provide the important code inside a minimal working example. Makes testing possible solutions much easier.
    – Johannes_B
    Commented Nov 1, 2014 at 21:42
  • @Johannes_B Okay, :D Commented Nov 1, 2014 at 21:46
  • 1
    You should not allow hyphenation in titles
    – Bernard
    Commented Nov 1, 2014 at 22:31
  • @Bernard I know, thanks, It was for example.. :D Commented Nov 2, 2014 at 17:00

1 Answer 1

12

You can align on the bottom row of the title:

enter image description here

\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}
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .