Graphics, Figures & Tablesgraphic in chapter title

Information and discussion about graphics, figures & tables in LaTeX documents.
snowbb451
Posts: 11
Joined: Tue Jan 12, 2010 12:39 am

graphic in chapter title

Post by snowbb451 »

I'm using TeXshop to format a book, and I want to include a graphic in the chapter title. how do i do this?

Recommended reading 2024:

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

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

User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

graphic in chapter title

Post by gmedina »

Hi,

the answer might vary on your particular needs. The following simple code shows one possibility:

Code: Select all

\documentclass{book}
\usepackage[demo]{graphicx}% demo option only for compilability purposes

\begin{document}
\tableofcontents

\chapter[Test chapter]{\parbox[c]{.55\textwidth}{Test chapter\\ with an image}\parbox[c]{.4\textwidth}{\includegraphics{imagename}}}

\end{document}
Note the use of the optional argument of the \chapter command in order to prevent the image from appearing in the Table of Contents. Don't forget to remove the demo option in your actual code.

Of course, we could give a more precise answer if you provide a more detailed explanation of your intent.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
snowbb451
Posts: 11
Joined: Tue Jan 12, 2010 12:39 am

Re: graphic in chapter title

Post by snowbb451 »

Sorry i wasn't too specific.

I'm using the Memoir document class. I want to place a picture next to the chapter title, which will be just roman numerals, about 1.5cm by 1.5cm.
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Re: graphic in chapter title

Post by gmedina »

But, do you have these roman numerals in separate graphic files (in one of the formats JPG, PNG) and you want to include them or do you want to create manually those roman numerals? And, how exactly must those numerals appear with respect to the title of the chapter?
1,1,2,3,5,8,13,21,34,55,89,144,233,...
snowbb451
Posts: 11
Joined: Tue Jan 12, 2010 12:39 am

graphic in chapter title

Post by snowbb451 »

I have this in the preamble

Code: Select all

\makeatletter
\newcommand{\rmnum}[1]{\romannumeral #1}
\newcommand{\Rmnum}[1]{\expandafter\@slowromancap\romannumeral #1@}
\makeatother
and I use \Rmnum{#} in chapter title. I planned to resize them to be the same size as the picture
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Re: graphic in chapter title

Post by gmedina »

Hi, again. I just want to be sure that I understood you correctly. I am attaching a pdf file that I produced. It consists of two chapters; each one has a big roman numeral and, to its right, an image. I added automatically some test text to each chapter. Is something like that what you are looking for (of course, using your own images)?
Attachments
test.pdf
(66.27 KiB) Downloaded 515 times
1,1,2,3,5,8,13,21,34,55,89,144,233,...
snowbb451
Posts: 11
Joined: Tue Jan 12, 2010 12:39 am

Re: graphic in chapter title

Post by snowbb451 »

thats exactly what I'm trying to do.
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

graphic in chapter title

Post by gmedina »

Hi,

I am attaching the file suggestion.zip which contains test.tex (the code contains some suggestions to help you achieve what you desire and some comments) and the images Smullyan.jpg and fibonacci.jpg, so that you can compile my example code. It also includes the PDF file obtained (test.pdf). Please refer to the documentation of the used packages. If you encounter any troubles, don't hesitate to ask for advise.
Attachments
suggestion.zip
(98.9 KiB) Downloaded 297 times
1,1,2,3,5,8,13,21,34,55,89,144,233,...
snowbb451
Posts: 11
Joined: Tue Jan 12, 2010 12:39 am

Re: graphic in chapter title

Post by snowbb451 »

Thank you. But how do I make it so this doesn't apply to the Foreword, and preface?
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

graphic in chapter title

Post by gmedina »

Simply move the lines of code corresponding to the \titleformat and \titlespacing* commands from the preamble of your document and place them right before the first \chapter command corresponding to a chapter that should have the modified title format.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
Post Reply