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.

How to get a different formatting for the label and text of a subsection using titlesec?

Reason: Italic numbers in the subsection heading hurts my eyes and should be avoided at all cost, Label of the subsection should be a normal roman while the text should be in italic

First I define the fonts for the section and subsection headings of my document using fontspec:

\usepackage{fontspec}
\usepackage{titlesec}
\newfontfamily\sectionfont[LetterSpace=16.0,Path=C:/fonts/]{LTe50383.pfb} %sectionfont in Sabon Roman
\newfontfamily\subsectionfont[Path=C:/fonts/]{LTe50384.pfb} %subsection font is Sabon Italic

After this I define the titleformats:

\titleformat{\section}{\sectionfont}{\thesection.}{1em}{\MakeUppercase}{}
\titleformat{\subsection}{\subsectionfont}{\thesubsection.}{1em}{}{}

Is it even possible to differ the formatting? As written in the titlesec manual:

format is the format to be applied to the whole title—label and text. This part can contain vertical material (and horizontal with some shapes) which is typeset just after the space above the title.

share|improve this question
add comment

1 Answer 1

up vote 4 down vote accepted
\titleformat{\subsection}{\subsectionfont}{\sectionfont\thesubsection.}{1em}{}{}

should do the trick.

share|improve this answer
    
oohww.. I tried that before but then for some reason it didnt work, but now it did. Thanks for the fast reply. –  Timtico Dec 6 '10 at 22:34
add comment

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.