Skip to content

Instantly share code, notes, and snippets.

@kroger
Created October 9, 2012 05:45
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save kroger/3856845 to your computer and use it in GitHub Desktop.
Save kroger/3856845 to your computer and use it in GitHub Desktop.
The LaTeX style file used in Music for Geeks and Nerds
\usepackage{wasysym}
\usepackage{moresize}
\usepackage{multicol}
\usepackage[Sonny]{fncychap}
\usepackage[margin=1in, paperwidth=6.69in, paperheight=9.61in]{geometry}
\usepackage[protrusion=true,expansion=true]{microtype}
\usepackage{xltxtra}
\setmainfont[Mapping=tex-text]{Minion Pro}
\setmonofont[Mapping=tex-text,Scale=0.85]{Inconsolata}
%\setmonofont[Mapping=tex-text,Scale=0.75]{DejaVu Sans Mono}
%\setmonofont[Mapping=tex-text,Scale=0.75]{Consolas}
%\setmonofont[Mapping=tex-text,Scale=0.8]{TheSansMono}
\usepackage{wallpaper}
\setlength{\headheight}{15pt}
\renewcommand{\bibname}{References}
\newcommand{\cover}{
\includegraphics{cover}
}
\@ifundefined{fancyhf}{}{
% Use \pagestyle{normal} as the primary pagestyle for text.
\fancypagestyle{normal}{
\fancyhf{}
\fancyfoot[LE,RO]{{\py@HeaderFamily\thepage}}
\fancyfoot[LO]{{\py@HeaderFamily\nouppercase{\rightmark}}}
\fancyfoot[RE]{{\py@HeaderFamily\nouppercase{\leftmark}}}
\fancyhead[LE,RO]{{\py@HeaderFamily \@title}}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}
}
% Update the plain style so we get the page number & footer line,
% but not a chapter or section title. This is to keep the first
% page of a chapter and the blank page between chapters `clean.'
\fancypagestyle{plain}{
\fancyhf{}
\fancyfoot[LE,RO]{{\py@HeaderFamily\thepage}}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0.4pt}
}
}
@vjousse
Copy link

vjousse commented May 21, 2013

Thanks for that!

It's maybe a stupid question but ... how do you tell Sphinx to use your custom LaTeX style? I don't see any straightforward way to do it. Am I missing something?

@sjardim
Copy link

sjardim commented Dec 4, 2013

@vjousse see this: https://github.com/coot/sphinx_latex
Maybe will help you. I didn't try yet.

@mementum
Copy link

mementum commented Nov 4, 2019

Thanks for that!

It's maybe a stupid question but ... how do you tell Sphinx to use your custom LaTeX style? I don't see any straightforward way to do it. Am I missing something?

Although 6 years later ... still relevant (I guess)

See the gist for the Makefile, it contains -D latex_elements.preamble=\\usepackage{mfgan-bw}. Here: https://gist.github.com/kroger/3856862

Notice the double \\. The post by Pedro Kroger shows only 1 backslash when referencing the options in the Makefile and that's possibly confusing. Here: https://pedrokroger.net/using-sphinx-write-technical-books/

Another option is to set the preamble directly in the conf.py of your project

latex_elements = {
    'preamble': r'\usepackage{mfgan-bw}',
    'other_options': '...',
}

Pedro Kroger is using the Makefile route, to be able to produce a paperback and a screen version of the book by just issuing the proper make xxx command, without having to change conf.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment