Hi, everybody.
I'm writing a book and I need to customize the chapter heads in order to show them like this:
I need to replicate the part enclosed by the black frame.
How could I do it?
Thanks for your help.
Graphics, Figures & Tables ⇒ How to use an image for customizing a chaper head?
-
- Posts: 26
- Joined: Thu Jul 06, 2017 5:37 am
- Johannes_B
- Site Moderator
- Posts: 4182
- Joined: Thu Nov 01, 2012 4:08 pm
How to use an image for customizing a chaper head?
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
-
- Posts: 26
- Joined: Thu Jul 06, 2017 5:37 am
How to use an image for customizing a chaper head?
Hi, Johannes. I know that I posted this topic in other forum The problem is that I'm still without a suggestion about how to get what I need for using an imported image in the chapter head.
I would greatly appreciate it if you or anyone else can help me.
Thanks.
I would greatly appreciate it if you or anyone else can help me.
Thanks.
- Johannes_B
- Site Moderator
- Posts: 4182
- Joined: Thu Nov 01, 2012 4:08 pm
How to use an image for customizing a chaper head?
Please, if you feel the need to crosspost, leave a link on all places referring to the other posts. It avoids double effort by the helpers. Please keep all crossposts updated at all times.
As it was said in the TeX.SX comments: A solution depends on the document class you are using. I myself am not even sure what image you mean. I can see the number of the chapter on the outside as well as a framed box which includes the chapter title. The framed boxed could be done with TikZ or tcolorbox. It doesn't seem too complex to me, but knowing the document class is very needed, as different classes define different internal commands that are accesed.
As it was said in the TeX.SX comments: A solution depends on the document class you are using. I myself am not even sure what image you mean. I can see the number of the chapter on the outside as well as a framed box which includes the chapter title. The framed boxed could be done with TikZ or tcolorbox. It doesn't seem too complex to me, but knowing the document class is very needed, as different classes define different internal commands that are accesed.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
-
- Posts: 26
- Joined: Thu Jul 06, 2017 5:37 am
How to use an image for customizing a chaper head?
Hellos, Johannes. I understand what you say.
I'm using the book class and the image that I have to use is the gray frame where the chapter title is written on.
You say that it's easy to draw it with tikz or tcolorbox, but I don't know much about those packages. I have the image of the gray frame and I want to know how import it and write the title of the chapter on it.
Is it possible combine \titleformat with \includegraphics in order to get what I need?
Thanks for your help.
I'm using the book class and the image that I have to use is the gray frame where the chapter title is written on.
You say that it's easy to draw it with tikz or tcolorbox, but I don't know much about those packages. I have the image of the gray frame and I want to know how import it and write the title of the chapter on it.
Is it possible combine \titleformat with \includegraphics in order to get what I need?
Thanks for your help.
-
- Posts: 26
- Joined: Thu Jul 06, 2017 5:37 am
How to use an image for customizing a chaper head?
Hellos, Johannes. I understand what you say.
I'm using the book class and the image that I have to use is the gray frame where the chapter title is written on.
You say that it's easy to draw it with tikz or tcolorbox, but I don't know much about those packages. I have the image of the gray frame and I want to know how import it and write the title of the chapter on it.
Is it possible combine \titleformat with \includegraphics in order to get what I need?
Thanks for your help.
I'm using the book class and the image that I have to use is the gray frame where the chapter title is written on.
You say that it's easy to draw it with tikz or tcolorbox, but I don't know much about those packages. I have the image of the gray frame and I want to know how import it and write the title of the chapter on it.
Is it possible combine \titleformat with \includegraphics in order to get what I need?
Thanks for your help.
-
- Posts: 26
- Joined: Thu Jul 06, 2017 5:37 am
How to use an image for customizing a chaper head?
Hello, everybody. Finally I could make the chapters heads as I need them.
I took the last example of
https://tex.stackexchange.com/questions ... er-heading
and I made it some changes. The final code that I made was
Here is what I got
What I learned with this is that is truly possible to combine \titleformat with \includegraphics and you can customize your chapters head in the way that you wish without using tikz/PGF packages.
Thanks for your help.
This topic can be closed.
I took the last example of
https://tex.stackexchange.com/questions ... er-heading
and I made it some changes. The final code that I made was
Code: Select all
\newcommand*{\chapnumfont}{%Define font and fontsize for the number of the chapter
\fontsize{3.2cm}{5cm}%
\selectfont\myfont%I defined previously a font and named it "myfont"
}
\newcommand*{\chaptitlefont}{%Define font and fontsize for the title of the chapter
\fontsize{22}{26}%
\selectfont\myfont%
}
\titleformat{\chapter}[block]%Insert the predefined image where the title o chapter is on
{\normalfont\huge\bfseries}
{\hspace{-2cm}\parbox{0pt}{\includegraphics[width=1.2\textwidth,height=1.5\baselineskip]{the image}}
{0pt}
{\begin{minipage}{11cm}\hspace{2cm}\filleft\color{your color}\chaptitlefont #1\end{minipage}\begin{minipage}{4cm} \vspace{-0.5cm}\filleft\chapnumfont\color{your color}\thechapter}[\end{minipage}]
Thanks for your help.
This topic can be closed.