1

SX

I'm still fairly new to latex and hoping to get some help on how to do the formatting of the font for chapters and headings. I've been looking around the forum for hours now, trying to see if I could piece it together myself but had to give up in the end.

I basically have two problems.

1. Desired format

1 Chapter 1.1 Section 1.1.1 Subsection 1.1.1.1 Subsubsection

I found this possible with:

\usepackage{titlesec}
\titleformat{\chapter}{}{}{0em}{\bf\LARGE\thechapter.~}

However this also puts a 0. in my Abstract chapter, which I don't know how to remove. It also creates double numbering in the ToC.

Is there a way around this so I can keep the numbering except for Abstract and not have double numbering in ToC?

2. Change Font

I found out how to change the font for the entire document. I simply used:

\usepackage[T1]{fontenc}
\usepackage{ebgaramond}
\usepackage[ebgaramond]{mathdesign}

I only wish to use Garamond as the normal text while using another font (http://surl.dk/e1e/ from this list most likely) for headings. How do I go about changing the fonts of the headings?

I'm on Mac OSX 10.9.4 using TeXworks.

screenshot of example

I appreciate any help.

Full code:

%% Preamble start

%%%% --- Basic ---

\documentclass[12pt,twoside]{report}
\usepackage[a4paper,width=150mm,top=25mm,bottom=25mm,bindingoffset=6mm]{geometry}


%%%% --- Typography ---

\usepackage[T1]{fontenc}
\usepackage{ebgaramond}
\usepackage[english]{babel}
\usepackage{csquotes}
\setlength\parindent{0pt}
\usepackage{titlepic}

%%%% --- Headings ---

%
% ?????
%

%%%% --- Math and Chem specifics ---

\usepackage[ebgaramond]{mathdesign}
\usepackage{amsmath,amssymb}
\usepackage[version=3]{mhchem}  %Easier to write chem compounds ie. \ce{H2O} and \ce{PO4^2-}

%% Preamble end

\title{Report Ex}
\author{John Smith}

\begin{document}
\maketitle
\chapter{Abstract}
Lorem ipsum dolor sit amet, consectetur adipiscing elit.\\
\tableofcontents
\chapter{Introduction}
\section{Background}
Lorem ipsum dolor sit amet, consectetur adipiscing elit.\\
%
\subsection{Details}
Lorem ipsum dolor sit amet, consectetur adipiscing elit.\\
%
%
\section{History}
Lorem ipsum dolor sit amet, consectetur adipiscing elit.\\
%
\section{Analysis}
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
\end{document}
4
  • We need to see a minimal working example (MWE) to be of much help, I'm afraid. Right now, we don't know what class you are using or how you are coding your abstract or much of anything. However, note that mathdesign has no ebgaramond option. So you are getting default mathdesign fonts (if any). Your .log or console output will include warnings about this. Also, don't use \bf. It is deprecated. Use \bfseries instead. And I think, though I'm not sure, you're putting \thechapter in the wrong argument of \titleformat (hence the toc issue).
    – cfr
    Sep 9, 2014 at 1:14
  • I didn't know about the restrictions of the ebgaramond font. It was just the only way I could get garamond to work (sorry, still very much new to latex). How should I implemt my use of fonts? I have added photo to the original post.
    – mendokusai
    Sep 9, 2014 at 1:47
  • I just posted my full code as is. If I try using \usepackage[garamond]{mathdesign} it just gives an error: ! LaTeX Error: Command `\circledS' already defined.
    – mendokusai
    Sep 9, 2014 at 1:58
  • The closest code I could find to work is this but it gives numbering to Abstract & Contents as well, which I do not want. \usepackage{titlesec} \titleformat{\chapter}{}{}{0em}{\bf\LARGE\thechapter.~}
    – mendokusai
    Sep 9, 2014 at 2:17

1 Answer 1

1

If I've understood correctly, this should do what you want. I've commented the code a bit.

To use the garamond option, you need to install URW Garamond. You can do this using getnonfreefonts-sys which is a script you can use to easily install additional fonts. Make sure you use the sys version when you run the script.

\documentclass[12pt,twoside,a4paper]{report}
\usepackage[width=150mm,top=25mm,bottom=25mm,bindingoffset=6mm]{geometry}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage[version=3]{mhchem}  %Easier to write chem compounds ie. \ce{H2O} and \ce{PO4^2-}
\usepackage[garamond]{mathdesign}
\usepackage[british]{babel}% if you want UK - otherwise use american
\usepackage{csquotes}
\usepackage{parskip}% don't set \parindent and \parskip manually (and you'll want positive parskip if parindent is zero so this should work OK)
\usepackage{titlesec}
\titleformat{\chapter}{\bfseries\LARGE}{\thechapter~}{0em}{}

\title{Report Ex}
\author{John Smith}

\begin{document}
\maketitle
\chapter*{Abstract}
    Lorem ipsum dolor sit amet, consectetur adipiscing elit.

\tableofcontents

\chapter{Introduction}

\section{Background}
Lorem ipsum dolor sit amet, consectetur adipiscing elit.

\subsection{Details}
Lorem ipsum dolor sit amet, consectetur adipiscing elit.

\section{History}
Lorem ipsum dolor sit amet, consectetur adipiscing elit.

\section{Analysis}
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
\end{document}

EBGaramond lacks bold by design. So if you want to use bold, you need to use another garamond. If you want to stick to EBGaramond, don't use mathdesign as it does not support EBGaramond and is causing you to end up with a mixture of EBGaramond for regular weight and something else for bold which cannot be good.

7
  • If I try to run that I get: [1] (./TexEx.toc) [2] Chapter 1. [3] (./TexEx.aux) ){/usr/local/texlive/2014/texmf-dist/fonts/enc/dvips/ly1/texn ansi.enc} !pdfTeX error: /usr/texbin/pdflatex (file ugmm8a.pfb): cannot open Type 1 font file for reading ==> Fatal error occurred, no output PDF file produced!
    – mendokusai
    Sep 9, 2014 at 2:23
  • something about: Package mathdesign/mdugm Warning: Package 'amsfonts' shouldn't be used in conjo nction with package mdugm, on input line 16.
    – mendokusai
    Sep 9, 2014 at 2:25
  • 1
    Oh, sorry. I forgot that URW Garamond is not in TeX Live either. I think if you want garamond and you want bold, you are going to need to use the getnonfreefonts-sys script to install additional fonts.
    – cfr
    Sep 9, 2014 at 2:29
  • 1
    @user2927919 I've updated my answer and added a link. Those instructions work fine on a Mac. You may want to use garamondx since you have to install additional fonts anyway. The script will let you install a number of fonts. garamondx is an extension of garamond.
    – cfr
    Sep 9, 2014 at 2:35
  • 1
    @user2927919 Great! See my update. In that case, don't bother with the abstract environment. Just use an unnumbered chapter (which won't appear in the toc by default). The * makes the chapter unnumbered.
    – cfr
    Sep 9, 2014 at 2:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .