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.

I am trying to edit my page titles with fancyhdr package. I want the top left of the page to present [section number]. [section name] in boldface and small caps. for example:

3.2. PYTHAGORAS THEOREM

I noticed that \leftmark puts the small-caps letter in a nice way (with proper space between them, and also straight, which doesn't happen with some other methods) but if I try to edit it

\renewcommand{\leftmark}{...}

I lose the small caps. What is the best way to achieve what I want?

An example code to build on:

\documentclass[a4paper,11pt,english]{book}
\usepackage{fancyhdr}
\usepackage[english]{babel}
\fancyhead[LE,LO]{\leftmark}
\fancyhead[RE,RO]{\bfseries \thepage}
\pagestyle{fancy}

\usepackage{blindtext}
\begin{document}
    \chapter{My first chapter}
    \blindtext
    \section{My first section}
    \blindtext[10]  
\end{document}
share|improve this question

1 Answer 1

up vote 7 down vote accepted

I recommend using formatting commands within fancyhdr commands, such as in \fancyhead, instead of redefining \leftmark. More important, you need to use a font with bold small caps. The default font doesn't have small caps. This could be the reason why you notice you loose small caps when switching to bold.

In your example, with kpfonts, you would get bold small caps text in the header:

\usepackage{kpfonts}
\fancyhead[LE,LO]{\textsc{\textbf{\nouppercase{\leftmark}}}}

heading with bold small caps

share|improve this answer
    
Thanks for the answer. but how do I produce a heading in the form I mentioned in my question? in my example code, it should be: 1.1. MY FIRST SECTION where ** denotes bold letters. I don't know which command would get the appropriate [section name], which is "My First Section" here. Also, is it possible to apply the small-caps with the computer-modern font? or which other fonts support it? –  Andro Oct 4 '11 at 18:57
    
@Andro The section name is usually in \rightmark. Try: \fancyhead[LE,LO]{\textsc{\textbf{\nouppercase{\rightmark}}}}. Regarding bold small caps in CM try: \usepackage{bold-extra} however I doubt it looks great - but see for yourself. –  Stefan Kottwitz Oct 4 '11 at 19:04
    
Thanks. it does indeed write what I want. regarding the font - I can't make computer modern present small-caps and bfseries together at all. I took the idea for headings from this document: tcm.phy.cam.ac.uk/~bds10/aqp/handout_operator.pdf is it not a computer-modern font? –  Andro Oct 4 '11 at 19:16
    
The fonts in the link you provide sure look like CM. However, the text in the header line is "ordinary" bold, not small-caps bold. Some font families that feature small caps & bold glyphs are mathptmx and txfonts (Times New Roman-like fonts) and mathpazo and pxfonts (Palatino-like fonts). –  Mico Oct 4 '11 at 19:23
    
@Mico what is the difference between "ordinary" capital letters and small-caps? How do you produce letters such as in that document? I notice that small-caps are not "straight" in the sense that not all letters have the same size, is that intentional? and is the fact that SC and BF don't naturally work together - a bug? –  Andro Oct 4 '11 at 19:33

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.