From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id E88A69AB5 for ; Tue, 3 Feb 2015 11:30:38 +0100 (CET) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP; 03 Feb 2015 02:26:00 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,512,1418112000"; d="scan'208";a="521785531" Received: from irsmsx152.ger.corp.intel.com ([163.33.192.66]) by orsmga003.jf.intel.com with ESMTP; 03 Feb 2015 02:23:02 -0800 Received: from irsmsx108.ger.corp.intel.com ([169.254.11.64]) by IRSMSX152.ger.corp.intel.com ([169.254.6.43]) with mapi id 14.03.0195.001; Tue, 3 Feb 2015 10:30:35 +0000 From: "Iremonger, Bernard" To: "Mcnamara, John" , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v3 2/4] doc: Add Sphinx config to build pdf version of guides Thread-Index: AQHQPuqI0l1vdQ3Q20ikNJckS3V46JzeuupQ Date: Tue, 3 Feb 2015 10:30:34 +0000 Message-ID: <8CEF83825BEC744B83065625E567D7C2049DCFB3@IRSMSX108.ger.corp.intel.com> References: <1421255657-19521-1-git-send-email-john.mcnamara@intel.com> <1422882967-27060-1-git-send-email-john.mcnamara@intel.com> <1422882967-27060-3-git-send-email-john.mcnamara@intel.com> In-Reply-To: <1422882967-27060-3-git-send-email-john.mcnamara@intel.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.182] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v3 2/4] 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 10:30:39 -0000 > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of John McNamara > Sent: Monday, February 2, 2015 1:16 PM > To: dev@dpdk.org > Subject: [dpdk-dev] [PATCH v3 2/4] doc: Add Sphinx config to build pdf ve= rsion of guides >=20 > Add Python Sphinx config to allow conversion of guides to Latex and then = PDF format. >=20 > This mainly adds metadata but also includes an override to the Latex form= atter to control the font size > in code blocks. >=20 > Signed-off-by: John McNamara > --- > doc/guides/conf.py | 44 +++++++++++++++++++++++++++++++++++++++++++- > 1 files changed, 43 insertions(+), 1 deletions(-) >=20 > diff --git a/doc/guides/conf.py b/doc/guides/conf.py index 385af03..9f546= bd 100644 > --- a/doc/guides/conf.py > +++ b/doc/guides/conf.py > @@ -29,11 +29,53 @@ > # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >=20 > import subprocess > +from sphinx.highlighting import PygmentsBridge from > +pygments.formatters.latex import LatexFormatter >=20 > project =3D 'DPDK' >=20 > copyright =3D '2014, Intel' Hi John, 2014 should be 2015. Regards, Bernard. >=20 > -version =3D subprocess.check_output(["make","-sRrC","../../", "showversi= on"]) > +version =3D subprocess.check_output(['make', '-sRrC', '../../', > +'showversion']) release =3D version >=20 > master_doc =3D 'index' > + > +# Latex directives to be included directly in the latex/pdf docs. > +latex_preamble =3D r""" > +\usepackage[utf8]{inputenc} > +\usepackage{DejaVuSansMono} > +\usepackage[T1]{fontenc} > +\usepackage{helvet} > +\renewcommand{\familydefault}{\sfdefault} > + > +\RecustomVerbatimEnvironment{Verbatim}{Verbatim}{xleftmargin=3D5mm} > +""" > + > +# Configuration for the latex/pdf docs. > +latex_elements =3D { > + 'papersize': 'a4paper', > + 'pointsize': '11pt', > + 'preamble': latex_preamble} > + > +latex_documents =3D [ > + ('index', > + 'dpdk_doc.tex', > + '', > + '', > + 'manual')] > + > + > +# Temp class to override the default Latex formatter in order to modify > +the # font size in 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 =3D r'formatcom=3D\footnotesize' > + > +# Replace the default latex formatter. > +PygmentsBridge.latex_formatter =3D CustomLatexFormatter > -- > 1.7.4.1