0

I have two problems while working on this code :

\documentclass[11pt]{book}
\usepackage{fontspec}

\makeatletter
\renewcommand*{\@makechapterhead}[1]{
  \vspace*{50\p@}
  {%
    \parindent \z@ \raggedright
    \setmainfont{Book Antiqua}
    \ifnum \c@secnumdepth >\m@ne
      \if@mainmatter
        \large \bfseries \@chapapp \space \thechapter \par
        \nobreak \vskip 20\p@
        \setmainfont{Adine Kirnberg Regular}
      \fi
    \fi
    \interlinepenalty \@M \Huge \bfseries #1\par
    \nobreak \vskip 40\p@
  }}
\makeatother

\begin{document}
\chapter*{Introduction}
Some text in intro.
\chapter{This is the first chapter}
Some text in chapter 1.
\chapter{This is the second chapter}
Some text in chapter 2.
\end{document}

I need another way to set size to 38p because \Huge is not big enough for the font Adine Kirnberg Regular (found here http://www.1001fonts.com/adine-kirnberg-font.html), and \chapter*{Introduction}doesnt have the same font as the others. I gave up on using titling because I also change how the chapter are numbered.

  • is \fontsize{3cm}{3.5cm}\selectfont big enough? – David Carlisle Oct 16 '17 at 20:29
  • \@makechapterhead is for numbered headings in book.cls you will find \@makeschapterhead for stared (un-numbered) chapters which you can redefine to match. – David Carlisle Oct 16 '17 at 20:31
  • Can I use the same code ? – alfred Oct 16 '17 at 20:32
  • you should not be using \setmainfont within these heading macros that is for setting the default font for the whole document not to select a local font for this heading – David Carlisle Oct 16 '17 at 20:32
  • well no because for unnumbered headings you don't want to use \thechapter which is a number. just make matching changes to the two commands – David Carlisle Oct 16 '17 at 20:33
0

\@makechapterhead is for numbered headings in book.cls you will find \@makeschapterhead for stared (un-numbered) chapters which you can redefine to match.

You can use any size font \fontsize{38}{42}\selectfont for 38pt on a 42pt baseline for example.

0

I am posting the code for any case

\documentclass[11pt]{book}
\usepackage{fontspec}

\makeatletter % changing font and size for \chapter*{}
\renewcommand*{\@makeschapterhead}[1]{
  \vspace*{50\p@}
  {%
    \parindent \z@ \raggedright
    \setmainfont{Adine Kirnberg Regular}
    \interlinepenalty \@M \fontsize{38}{42}\selectfont \bfseries #1\par
    \nobreak \vskip 40\p@
  }}
\makeatother

\makeatletter % changing font and size for \chapter{}
\renewcommand*{\@makechapterhead}[1]{
  \vspace*{50\p@}
  {%
    \parindent \z@ \raggedright
    \setmainfont{Book Antiqua}
    \ifnum \c@secnumdepth >\m@ne
      \if@mainmatter
        \large \bfseries \@chapapp \space \thechapter \par
        \nobreak \vskip 20\p@
        \setmainfont{Adine Kirnberg Regular}
      \fi
    \fi
    \interlinepenalty \@M \fontsize{38}{42}\selectfont \bfseries #1\par
    \nobreak \vskip 40\p@
  }}
\makeatother

\begin{document}
\chapter*{Introduction}
Some text in intro.
\chapter{This is the first chapter}
Some text in chapter 1.
\chapter{This is the second chapter}
Some text in chapter 2.
\end{document} 

I don't know how to set the font locally for Open Type so I keep using \setmainfont{}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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