From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 49FA69AC9 for ; Tue, 3 Feb 2015 15:14:16 +0100 (CET) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP; 03 Feb 2015 06:11:23 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,862,1389772800"; d="scan'208";a="449196488" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by FMSMGA003.fm.intel.com with ESMTP; 03 Feb 2015 05:57:14 -0800 Received: from sivswdev02.ir.intel.com (sivswdev02.ir.intel.com [10.237.217.46]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id t13EBLXU015572; Tue, 3 Feb 2015 14:11:21 GMT Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id t13EBLr3008041; Tue, 3 Feb 2015 14:11:21 GMT Received: (from jmcnam2x@localhost) by sivswdev02.ir.intel.com with id t13EBLEf008036; Tue, 3 Feb 2015 14:11:21 GMT From: John McNamara To: dev@dpdk.org Date: Tue, 3 Feb 2015 14:11:15 +0000 Message-Id: <1422972678-7982-3-git-send-email-john.mcnamara@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1422972678-7982-1-git-send-email-john.mcnamara@intel.com> References: <1421255657-19521-1-git-send-email-john.mcnamara@intel.com> <1422972678-7982-1-git-send-email-john.mcnamara@intel.com> Subject: [dpdk-dev] [PATCH v4 2/5] doc: Add Sphinx config to build pdf version of guides X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Feb 2015 14:14:17 -0000 Add Python Sphinx config to allow conversion of guides to Latex and then PDF format. 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 --- doc/guides/conf.py | 48 +++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 45 insertions(+), 3 deletions(-) diff --git a/doc/guides/conf.py b/doc/guides/conf.py index 385af03..1c03b50 100644 --- a/doc/guides/conf.py +++ b/doc/guides/conf.py @@ -1,5 +1,5 @@ # BSD LICENSE -# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# Copyright(c) 2010-2015 Intel Corporation. All rights reserved. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -29,11 +29,53 @@ # 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' -copyright = '2014, Intel' +copyright = '2015, Intel' -version = subprocess.check_output(["make","-sRrC","../../", "showversion"]) +version = subprocess.check_output(['make', '-sRrC', '../../', 'showversion']) +release = version master_doc = 'index' + +# 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', + 'preamble': latex_preamble} + +latex_documents = [ + ('index', + 'dpdk_doc.tex', + '', + '', + 'manual')] + + +# Temp class to 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 -- 1.7.4.1