From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: [PATCH v5 6/7] doc: tune pdf fonts Date: Thu, 19 Mar 2015 12:23:23 +0100 Message-ID: <1426764204-3882-7-git-send-email-thomas.monjalon@6wind.com> References: <1422972678-7982-1-git-send-email-john.mcnamara@intel.com> <1426764204-3882-1-git-send-email-thomas.monjalon@6wind.com> Cc: dev-VfR2kkLFssw@public.gmane.org To: john.mcnamara-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org Return-path: In-Reply-To: <1426764204-3882-1-git-send-email-thomas.monjalon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces-VfR2kkLFssw@public.gmane.org Sender: "dev" From: John McNamara This mainly adds metadata but also includes an override to the Latex formatter to control the font size in code blocks. Signed-off-by: John McNamara Acked-by: Bernard Iremonger --- doc/guides/conf.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/doc/guides/conf.py b/doc/guides/conf.py index 7151dfd..168efa6 100644 --- a/doc/guides/conf.py +++ b/doc/guides/conf.py @@ -29,6 +29,8 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. import subprocess +from sphinx.highlighting import PygmentsBridge +from pygments.formatters.latex import LatexFormatter project = 'DPDK' @@ -46,3 +48,32 @@ latex_documents = [ '', 'manual') ] + +# Latex directives to be included directly in the latex/pdf docs. +latex_preamble = r""" +\usepackage[utf8]{inputenc} +\usepackage{DejaVuSansMono} +\usepackage[T1]{fontenc} +\usepackage{helvet} +\renewcommand{\familydefault}{\sfdefault} +\RecustomVerbatimEnvironment{Verbatim}{Verbatim}{xleftmargin=5mm} +""" + +# Configuration for the latex/pdf docs. +latex_elements = { + 'papersize': 'a4paper', + 'pointsize': '11pt', + # customize Latex formatting + 'preamble': latex_preamble +} + +# Override the default Latex formatter in order to modify the +# code/verbatim blocks. +class CustomLatexFormatter(LatexFormatter): + def __init__(self, **options): + super(CustomLatexFormatter, self).__init__(**options) + # Use the second smallest font size for code/verbatim blocks. + self.verboptions = r'formatcom=\footnotesize' + +# Replace the default latex formatter. +PygmentsBridge.latex_formatter = CustomLatexFormatter -- 2.2.2