Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sorry. I am new at this and it is my first time asking a question. I was reading this posting:

how to change chapter/section style in tufte-book?

How does one also get the subsections to change to the same colors as the sections as in the top image?

Also, how does one make the chapter have a similar style to the section headings?

share|improve this question
1  
Welcome to TeX.sx! There is no need to add a signature or thanks to the post. Simply upvote answers to show your appreciation for any help. –  Peter Jansson Jan 30 '13 at 22:12
1  
Don't be sorry, it's a very reasonable question :) Welcome! –  cmhughes Jan 30 '13 at 22:33
1  
Thank you! I look forward to participating. This resource so far has been tremendously helpful. –  RobertD Jan 30 '13 at 22:36

1 Answer 1

The tufte documentclass loads the titlesec package, so we have immediate access to all of its excellent features.

Indeed, tufte-common.def contains declarations for each of chapter, section and subsection using the titleformat. We can tweak them to give us what we want- in your case, using colorbox to help us. A complete MWE is at the end, but here's the bit that we need for your requirements:

% chapter format
\titleformat{\chapter}%
  {\huge\rmfamily\itshape\color{red}}% format applied to label+text
  {\llap{\colorbox{red}{\parbox{1.5cm}{\hfill\itshape\huge\color{white}\thechapter}}}}% label
  {2pt}% horizontal separation between label and title body
  {}% before the title body
  []% after the title body

Note that I've used \llap to push the number into the left margin- you can tweak the horizontal separator as you wish. The tweaks for section and subsection are very similar.

The only other subtlety is that I have used

\setcounter{secnumdepth}{2}

so that we get numbers for all of the section headings (the default value is -1 which turns all the numbers off).

screenshot

\documentclass[a4paper,twoside]{tufte-book}

\usepackage{xcolor} % for colour
\usepackage{lipsum} % just for sample text

% add numbers to chapters, sections, subsections
\setcounter{secnumdepth}{2}

% chapter format
\titleformat{\chapter}%
  {\huge\rmfamily\itshape\color{red}}% format applied to label+text
  {\llap{\colorbox{red}{\parbox{1.5cm}{\hfill\itshape\huge\color{white}\thechapter}}}}% label
  {2pt}% horizontal separation between label and title body
  {}% before the title body
  []% after the title body

% section format
\titleformat{\section}%
  {\normalfont\Large\itshape\color{orange}}% format applied to label+text
  {\llap{\colorbox{orange}{\parbox{1.5cm}{\hfill\color{white}\thesection}}}}% label
  {1em}% horizontal separation between label and title body
  {}% before the title body
  []% after the title body

% subsection format
\titleformat{\subsection}%
  {\normalfont\large\itshape\color{blue}}% format applied to label+text
  {\llap{\colorbox{blue}{\parbox{1.5cm}{\hfill\color{white}\thesubsection}}}}% label
  {1em}% horizontal separation between label and title body
  {}% before the title body
  []% after the title body

\begin{document}

\chapter{Chapter}
\lipsum[1]
\section{Section}
\lipsum[1]
\subsection{Sub section}
\lipsum[1]

\end{document}
share|improve this answer
1  
Thank you! This looks great. –  RobertD Jan 31 '13 at 6:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.