LaTeX forum ⇒ Theses, Books, Title pagesmore space for chapter title Topic is solved

Classicthesis, Bachelor and Master thesis, PhD, Doctoral degree
templateuser
Posts: 679
Joined: Tue Mar 03, 2015 4:01 pm

more space for chapter title

Postby templateuser » Mon Mar 09, 2015 9:49 am

Hello all,

I thank the community for providing usefull support for this great template.

I have one problem:
Some of my chapter titles are rather long. As a consequence they are cut off after 5 to 7 words.
Now my question:
Is it possible to extend the chapter title over several rows and to adopt the size of the orange box accordingly?

Best regards

snoocad

Tags:

User avatar
Vel
Site Moderator
Posts: 454
Joined: Fri Jun 29, 2012 1:20 am

Postby Vel » Mon Mar 09, 2015 9:49 am

Hey snoocad,

You can deal with this problem in a few different ways. The first is to decrease the font size of all chapter titles, but this is probably not the best since then you need to adjust the size of the rounded box they are in. The alternative is to use 2 titles for the longer chapters - one shorter one that appears in the chapter header at the beginning of the chapter and a longer one that appears in the table of contents and in the header of each page in that chapter.

An example of this is: \chapter[Text Chapter: A Careful Inspection]{Text Chapter}

The chapter header will now display "1 - Text Chapter" for this chapter but the table of contents and the headers on each page will display the longer version "Text Chapter: A Careful Inspection".

Cheers,
Vel
Founder and administrator of LaTeXTemplates.com and LaTeXTypesetting.com

MaverickVG
Posts: 4
Joined: Thu Sep 29, 2016 5:03 pm

Postby MaverickVG » Fri Sep 30, 2016 9:01 am

Hey!

is it possible to have 2 lines for the chapter title at the beginning of each chapter? This would help me a lot!

Thanks,

Sebastian

User avatar
cgnieder
Site Moderator
Posts: 1988
Joined: Sat Apr 16, 2011 7:27 pm

Postby cgnieder » Sat Oct 01, 2016 2:59 pm

The template has inefficient and restricting definitions of \@makechapterhead (numbered chapters) and \@makeschapterhead (unnumbered chapters). Here are improved versions which allow multiline chapter titles:

  1. \makeatletter
  2. \tikzset{
  3. chaptertitle/.style={
  4. line width = 2pt ,
  5. rounded corners = 15pt ,
  6. draw = ocre ,
  7. fill = white ,
  8. fill opacity = 0.5 ,
  9. inner sep = 15pt ,
  10. text = black,
  11. node font = \huge\sffamily\bfseries ,
  12. text width = \paperwidth-\Gm@lmargin-20pt ,
  13. align = left
  14. }
  15. }
  16.  
  17. \renewcommand\@makechapterhead[1]{%
  18. {%
  19. \parindent \z@ \raggedright \normalfont
  20. \ifnum \c@secnumdepth >\m@ne
  21. \begin{tikzpicture}[remember picture,overlay]
  22. \node at (current page.north west)
  23. {
  24. \begin{tikzpicture}[remember picture,overlay]
  25. \node[anchor=north west,inner sep=0pt] at (0,0)
  26. {\ifusechapterimage\includegraphics[width=\paperwidth]{\thechapterimage}\fi};
  27. \node[anchor=south west,chaptertitle] at (\Gm@lmargin,-9cm)
  28. {\if@mainmatter\thechapter. \fi#1\strut};
  29. \end{tikzpicture}
  30. };
  31. \end{tikzpicture}
  32. \fi
  33. \par\vspace*{270\p@}
  34. }%
  35. }
  36.  
  37. \renewcommand\@makeschapterhead[1]{%
  38. \begin{tikzpicture}[remember picture,overlay]
  39. \node at (current page.north west)
  40. {
  41. \begin{tikzpicture}[remember picture,overlay]
  42. \node[anchor=north west,inner sep=0pt] at (0,0)
  43. {\ifusechapterimage\includegraphics[width=\paperwidth]{\thechapterimage}\fi};
  44. \node[anchor=south west,chaptertitle] at (\Gm@lmargin,-9cm)
  45. {#1\strut};
  46. \end{tikzpicture}
  47. };
  48. \end{tikzpicture}
  49. \par\vspace*{270\p@}
  50. }
  51. \makeatother


Adding this to the preamble and using

  1. \chapterimage{chapter_head_2.pdf}
  2. \chapter{Text Chapter so long that it spans two lines. Indeed so long that it
  3. spans two lines.}


gives

lob1.png
lob1.png (187.44 KiB) Viewed 2863 times


More lines are also possible:

lob2.png
lob2.png (187.96 KiB) Viewed 2863 times


BTW: this code in the template

  1. \newpage
  2. ~\vfill
  3. \thispagestyle{empty}
  4.  
  5. \noindent Copyright \copyright\ 2013 John Smith\\ % Copyright notice
  6.  
  7. \noindent \textsc{Published by Publisher}\\ % Publisher
  8.  
  9. \noindent \textsc{book-website.com}\\ % URL
  10.  
  11. \noindent Licensed under the Creative Commons Attribution-NonCommercial 3.0
  12. Unported License (the ``License''). You may not use this file except in
  13. compliance with the License. You may obtain a copy of the License at
  14. \url{http://creativecommons.org/licenses/by-nc/3.0}. Unless required by
  15. applicable law or agreed to in writing, software distributed under the License
  16. is distributed on an \textsc{``as is'' basis, without warranties or conditions
  17. of any kind}, either express or implied. See the License for the specific
  18. language governing permissions and limitations under the
  19. License.\\
  20.  
  21. \noindent \textit{First printing, March 2013}


is against quite a few best practices in LaTeX: paragraph spacing by ending a paragraph with \\ – one should never do that. One of the consequences is a number of underfull hboxes; multiple \noindents is also not very nice; ~\vfill is just wrong. Better:

  1. \newpage
  2. \thispagestyle{empty}
  3. \vspace*{\fill}
  4. \begingroup
  5. \setlength\parskip{\baselineskip}
  6. \setlength\parindent{0pt}
  7. Copyright \copyright\ 2013 John Smith
  8.  
  9. \textsc{Published by Publisher}
  10.  
  11. \textsc{book-website.com}
  12.  
  13. Licensed under the Creative Commons Attribution-NonCommercial 3.0 Unported
  14. License (the ``License''). You may not use this file except in compliance
  15. with the License. You may obtain a copy of the License at
  16. \url{http://creativecommons.org/licenses/by-nc/3.0}. Unless required by
  17. applicable law or agreed to in writing, software distributed under the
  18. License is distributed on an \textsc{``as is'' basis, without warranties or
  19. conditions of any kind}, either express or implied. See the License for
  20. the specific language governing permissions and limitations under the
  21. License.
  22.  
  23. \textit{First printing, March 2013}
  24. \endgroup


There may be further places for improvement but I haven't checked :)

Regards
Clemens
------------------------------
chemmacros · chemformula · leadsheets · xsim

MaverickVG
Posts: 4
Joined: Thu Sep 29, 2016 5:03 pm

Postby MaverickVG » Tue Oct 04, 2016 2:41 pm

Thank you very much! This helped a lot.

One more question: with the new code the text also has a opacity of 0.5. How to get the text back at 1.0? If I change the value than the white background is also set to 1.0 and is not transparent anymore.

Thanks!

Edit: I found it by myself, just add text opacity = 1.0 to the definition and it works!

User avatar
cgnieder
Site Moderator
Posts: 1988
Joined: Sat Apr 16, 2011 7:27 pm

Postby cgnieder » Tue Oct 04, 2016 2:46 pm

Add text opacity = 1 to the style definition..
Clemens
------------------------------
chemmacros · chemformula · leadsheets · xsim


Return to “Theses, Books, Title pages”

Who is online

Users browsing this forum: No registered users and 3 guests