GeneralA book with chapter names on the side of the page

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
imajcena
Posts: 5
Joined: Fri Oct 03, 2008 9:29 am

A book with chapter names on the side of the page

Post by imajcena »

I am writing a book. What I would like to do is have the chapter name written on the side of the page, just like in some dictionaries (for example the white letter a (blue background) in the top right corner of this dictionary).
I would also like to have it let's say in blue with white letters just like in the picture. I don't even know what to search for on the web. Any tips on how to do it or links will be highly appreciated.

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

A book with chapter names on the side of the page

Post by gmedina »

Hi,

the titlesec package allows you to customise the sectional headings.

Edit: I initially misunderstood your question. I designed an example to show some possibility to achieve what you desire (the code contains some remarks):

Code: Select all

\documentclass[twoside]{book}
\usepackage[absolute]{textpos}%to place the colored frame at absolute positions
\usepackage{color}%we will need colors
\usepackage{everypage}%we will perform some action (place a colored frame) in every page
\usepackage{ifthen}%but the position depends on whether the page is odd or even
\usepackage{lipsum}%just to generate some text

%declaration of the box that will contain the colored frame and its label
\newsavebox\myboxa

%creation of the colored frame
\newcommand\mylabel[1]{%
 \savebox\myboxa{\colorbox{blue}{\parbox[c][2cm][c]{3cm}{\centering\textcolor{white}{\Huge #1}}}}}

%placement of the colored box at the right extreme for even pages and at the left extreme for odd pages
\AddEverypageHook{%
  \ifthenelse{\isodd{\thepage}}%
  {%
    \begin{textblock*}{3cm}(18.4cm,2cm)
      \usebox\myboxa
    \end{textblock*}
  }%
  {%
    \begin{textblock*}{3cm}(0cm,2cm)
      \usebox\myboxa
    \end{textblock*}
  }}

\begin{document}

\chapter{First chapter}
\mylabel{A}
\lipsum[1-50]

\chapter{Second chapter}
\mylabel{B}
\lipsum[1-50]

\end{document}
Remarks: 1) The code above is just an example, and it admits improvements.
2) In the CTAN site you can find information about the packages that I used.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
imajcena
Posts: 5
Joined: Fri Oct 03, 2008 9:29 am

Re: A book with chapter names on the side of the page

Post by imajcena »

I think I will be able to modify it so that it suits my needs. Thank you.
Post Reply