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've got a problem that should be simple to fix. I'm using the fontspec to layout my chapter headings like so

%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode
\documentclass[oneside,a4paper,10pt]{book}
\usepackage{titlesec}
\usepackage[utf8x]{inputenc}
\usepackage{fontspec}
\titleformat{\chapter}[hang]
  {\normalfont\fontsize{25}{30}\bfseries\centering \fontspec{Times New Roman}}}
  {\chaptertitlename\ \thechapter:\space }{0pt}
  {}[]
   \begin{document}
   \chapter{The Road In The Wood}

   \end{document}

and for the most part it works just as I want. There is however one slight issue, some of my chapter headings run onto two lines - that's fine. However instead of centring the the second line properly it's placed towards the right of the page.

I believe what it's doing is centring as though the page begins just after the "Chapter 1" part of the heading. Is there a way to tell it to center based on the whole page?

share|improve this question
    
Welcome to TeX.sx! Please expand your code to a minimal working example (MWE), with a document class, (only!) all the necessary packages, etc. –  doncherry May 6 '12 at 13:35
    
All done. +charlimit –  Benjamin Confino May 6 '12 at 13:50
    
Thanks! Unfortunately, I can't help you with your problem, but I'm sure someone who can will come along soon. However, I do think you've got an erroneous brace in your code, sc. after Times New Roman; you only need two closing braces there. –  doncherry May 6 '12 at 13:57
add comment

1 Answer

up vote 6 down vote accepted

I've succeeded with

\titleformat{\chapter}[hang]
  {\normalfont\fontsize{25}{30}\bfseries\fontspec{Times New Roman}}
  {}
  {0pt}
  {\centering\chaptertitlename\ \thechapter:\space}

However I wouldn't use \fontspec, but rather

\newfontfamily{\timesnr}[Ligatures=TeX]{Times New Roman}

and \timesnr instead of \fontspec{Times New Roman}

Never use the inputenc package with XeLaTeX.

share|improve this answer
    
That did it, thank you :) –  Benjamin Confino May 6 '12 at 14:07
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.