Theses, Books, Title pagesChapter title too long for the box

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

Chapter title too long for the box

Post by templateuser »

Hello all,

I have tried to play with the line

Code: Select all

\draw[anchor=west] (1.5cm,-5.5cm)
  node [rounded corners=20pt,fill=ocre!10!white,text opacity=1,draw=ocre,draw opacity=1,
        line width=1.5pt,fill opacity=.85,inner sep=12pt]
    {\LARGE\sffamily\bfseries\textcolor{black}{Chapter \thechapter. #1\strut\makebox[22cm]{}}};
Unfortunately I don't get it to work: when the chapter title is too long, I would like the line to break (like the normal behavior of chapter). Is there a way to get this behavior?

thank you.

Best

egiem

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Chapter title too long for the box

Post by Stefan Kottwitz »

Hi egiem,

sure, TikZ just needs to know the width of the box for automatically breaking the line. You can use the text width key in the node options, such as

node [text width=22cm, ...] {long text}

or, as you already like to use a box (I see \makebox) you simply use a \parbox command in the node content text.

Stefan
LaTeX.org admin
Kotsos81
Posts: 2
Joined: Sun Sep 13, 2015 3:51 pm

Re: Chapter title too long for the box

Post by Kotsos81 »

Hello Stefan_K,

due to the fact that I am a new user of LaTeX, could you please post a working example with the required modifications you suggest? I don't know how to do what you said in your previous reply.

Thank you.

Kostas
Kotsos81
Posts: 2
Joined: Sun Sep 13, 2015 3:51 pm

Re: Chapter title too long for the box

Post by Kotsos81 »

Stefan,

I achieved what I wanted using the text width option, as you suggested! The only difference is that I had not to use the long text argument. (When I did, there was an error outputted - but nevermind, it works without that!) A million thanks!
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Re: Chapter title too long for the box

Post by Stefan Kottwitz »

Hi Kostas,

great that it works for you too! Thank you for the feedback.

And welcome to the forum! Maybe see you again here. :-)

Stefan
LaTeX.org admin
Post Reply