diff mbox series

[2/5] Docs: Remove redundant geometry package inclusion

Message ID 20170618234630.19964-3-corbet@lwn.net
State New
Headers show
Series Make PDF builds work again | expand

Commit Message

Jonathan Corbet June 18, 2017, 11:46 p.m. UTC
Commit 85c21e5c3ee7 (docs-rst: better adjust margins and font size) added a
\usepackage{geometry} that conflicts with another inclusion deep within the
dependencies somewhere, causing the the PDF build to fail with a
"conflicting parameters" error.  Just remove it for now until we can figure
out a better way.

Fixes: 85c21e5c3ee74fb75d690c57f7066bae7e2dca55
Cc: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>

---
 Documentation/conf.py | 2 --
 1 file changed, 2 deletions(-)

-- 
2.13.1

Comments

Mauro Carvalho Chehab June 19, 2017, 10:30 a.m. UTC | #1
Em Sun, 18 Jun 2017 17:46:27 -0600
Jonathan Corbet <corbet@lwn.net> escreveu:

> Commit 85c21e5c3ee7 (docs-rst: better adjust margins and font size) added a

> \usepackage{geometry} that conflicts with another inclusion deep within the

> dependencies somewhere, causing the the PDF build to fail with a

> "conflicting parameters" error.  Just remove it for now until we can figure

> out a better way.

> 

> Fixes: 85c21e5c3ee74fb75d690c57f7066bae7e2dca55

> Cc: Mauro Carvalho Chehab <mchehab@s-opensource.com>

> Signed-off-by: Jonathan Corbet <corbet@lwn.net>

> ---

>  Documentation/conf.py | 2 --

>  1 file changed, 2 deletions(-)

> 

> diff --git a/Documentation/conf.py b/Documentation/conf.py

> index 93827bc1620f..3d4e89330044 100644

> --- a/Documentation/conf.py

> +++ b/Documentation/conf.py

> @@ -271,8 +271,6 @@ latex_elements = {

>  

>  # Additional stuff for the LaTeX preamble.

>      'preamble': '''

> -	% Adjust margins

> -	\\usepackage[margin=0.5in, top=1in, bottom=1in]{geometry}

>          \\usepackage{ifthen}


This patch has a bad side effect: with it, the tables with this tag:
	.. tabularcolumns::

become too big, violating the right margin. If Sphinx 1.5.x or
1.6.x replaced geometry package with something else, then I
guess we'll need to add some hack at conf.py for it to adjust
it based on the Sphinx version.

Btw, in order to build latex output here with Sphinx 1.6.x,
I had to install this package:

	texlive-fncychap.noarch

Perhaps the change is somehow related to it.

Btw, the current documentation at:
	http://www.sphinx-doc.org/en/stable/latex.html

added a new option for version 1.5.3 and upper, to setup the
geometry, using 'sphinxsetup'. As described there:

	'sphinxsetup': 'hmargin={2in,1.5in}, vmargin={1.5in,2in}, marginpar=1in',

I'll play with it and see if I can use it on such versions.

Thanks,
Mauro
Mauro Carvalho Chehab June 19, 2017, 10:49 a.m. UTC | #2
Em Mon, 19 Jun 2017 07:30:38 -0300
Mauro Carvalho Chehab <mchehab@s-opensource.com> escreveu:

> Em Sun, 18 Jun 2017 17:46:27 -0600

> Jonathan Corbet <corbet@lwn.net> escreveu:

> 

> > Commit 85c21e5c3ee7 (docs-rst: better adjust margins and font size) added a

> > \usepackage{geometry} that conflicts with another inclusion deep within the

> > dependencies somewhere, causing the the PDF build to fail with a

> > "conflicting parameters" error.  Just remove it for now until we can figure

> > out a better way.

> > 

> > Fixes: 85c21e5c3ee74fb75d690c57f7066bae7e2dca55

> > Cc: Mauro Carvalho Chehab <mchehab@s-opensource.com>

> > Signed-off-by: Jonathan Corbet <corbet@lwn.net>

> > ---

> >  Documentation/conf.py | 2 --

> >  1 file changed, 2 deletions(-)

> > 

> > diff --git a/Documentation/conf.py b/Documentation/conf.py

> > index 93827bc1620f..3d4e89330044 100644

> > --- a/Documentation/conf.py

> > +++ b/Documentation/conf.py

> > @@ -271,8 +271,6 @@ latex_elements = {

> >  

> >  # Additional stuff for the LaTeX preamble.

> >      'preamble': '''

> > -	% Adjust margins

> > -	\\usepackage[margin=0.5in, top=1in, bottom=1in]{geometry}

> >          \\usepackage{ifthen}  

> 

> This patch has a bad side effect: with it, the tables with this tag:

> 	.. tabularcolumns::

> 

> become too big, violating the right margin. If Sphinx 1.5.x or

> 1.6.x replaced geometry package with something else, then I

> guess we'll need to add some hack at conf.py for it to adjust

> it based on the Sphinx version.

> 

> Btw, in order to build latex output here with Sphinx 1.6.x,

> I had to install this package:

> 

> 	texlive-fncychap.noarch

> 

> Perhaps the change is somehow related to it.

> 

> Btw, the current documentation at:

> 	http://www.sphinx-doc.org/en/stable/latex.html

> 

> added a new option for version 1.5.3 and upper, to setup the

> geometry, using 'sphinxsetup'. As described there:

> 

> 	'sphinxsetup': 'hmargin={2in,1.5in}, vmargin={1.5in,2in}, marginpar=1in',

> 

> I'll play with it and see if I can use it on such versions.


I guess the right fix would be do to something similar to what's in
the patch below.

There's a catch, though: as sphinxsetup hmargin/vmargin was added
only on Sphinx version 1.5.3, the enclosed patch won't adjust the
margins for versions 1.5.0 to 1.5.2. While I didn't test, I bet it
will just ignore the keys, showing some warning.


[PATCH] Docs: Fix breakage with Sphinx 1.5 and upper
    
Commit 85c21e5c3ee7 (docs-rst: better adjust margins and font size) added a
\usepackage{geometry} that conflicts with another inclusion deep within the
dependencies with newer versions of Sphinx, causing the the PDF build to fail
with a "conflicting parameters" error.
    
Detect the Sphinx version, using sphinxsetup for Sphinx versions 1.5 and
upper.
    
Fixes: 85c21e5c3ee74fb75d690c57f7066bae7e2dca55
Sighed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>diff --git a/Documentation/conf.py b/Documentation/conf.py
index 9eff2c8f7f67..900b9cfea430 100644
--- a/Documentation/conf.py
+++ b/Documentation/conf.py
@@ -271,8 +271,6 @@ latex_elements = {
 
 # Additional stuff for the LaTeX preamble.
     'preamble': '''
-	% Adjust margins
-	\\usepackage[margin=0.5in, top=1in, bottom=1in]{geometry}
         \\usepackage{ifthen}
 
         % Allow generate some pages in landscape
@@ -343,6 +341,12 @@ latex_elements = {
 if major == 1 and minor > 3:
     latex_elements['preamble']  += '\\renewcommand*{\\DUrole}[2]{ #2 }\n'
 
+if major == 1 and minor < 5:
+    latex_elements['preamble']  += '\\usepackage[margin=0.5in, top=1in, bottom=1in]{geometry}'
+else:
+    latex_elements['sphinxsetup'] = 'hmargin=0.5in, vmargin=0.5in'
+
+
 # Grouping the document tree into LaTeX files. List of tuples
 # (source start file, target name, title,
 #  author, documentclass [howto, manual, or own class]).

Jonathan Corbet June 23, 2017, 7:39 p.m. UTC | #3
On Mon, 19 Jun 2017 07:49:06 -0300
Mauro Carvalho Chehab <mchehab@s-opensource.com> wrote:

> There's a catch, though: as sphinxsetup hmargin/vmargin was added

> only on Sphinx version 1.5.3, the enclosed patch won't adjust the

> margins for versions 1.5.0 to 1.5.2. While I didn't test, I bet it

> will just ignore the keys, showing some warning.


And people routinely accuse *me* of being overly optimistic...

> ! Package keyval Error: hmargin undefined.

> 

> See the keyval package documentation for explanation.

> Type  H <return>  for immediate help.

>  ...                                              

>                                                   

> l.19 \sphinxsetup{hmargin=0.5in, vmargin=0.5in}

>                                                

> ? 


So it kills the build on 1.5.2.

I've made a tweak to special-case early 1.5.x.  

> Fixes: 85c21e5c3ee74fb75d690c57f7066bae7e2dca55

> Sighed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>


Sighed-off-by indeed, I agree.  It's a good thing there's a lot of beer in
the fridge...

jon
Mauro Carvalho Chehab June 23, 2017, 9:26 p.m. UTC | #4
Em Fri, 23 Jun 2017 13:39:51 -0600
Jonathan Corbet <corbet@lwn.net> escreveu:

> On Mon, 19 Jun 2017 07:49:06 -0300

> Mauro Carvalho Chehab <mchehab@s-opensource.com> wrote:

> 

> > There's a catch, though: as sphinxsetup hmargin/vmargin was added

> > only on Sphinx version 1.5.3, the enclosed patch won't adjust the

> > margins for versions 1.5.0 to 1.5.2. While I didn't test, I bet it

> > will just ignore the keys, showing some warning.  

> 

> And people routinely accuse *me* of being overly optimistic...


:-)

> > ! Package keyval Error: hmargin undefined.

> > 

> > See the keyval package documentation for explanation.

> > Type  H <return>  for immediate help.

> >  ...                                              

> >                                                   

> > l.19 \sphinxsetup{hmargin=0.5in, vmargin=0.5in}

> >                                                

> > ?   

> 

> So it kills the build on 1.5.2.


Murphy's law applied to coding: Anything untested that can go wrong 
will go wrong :-)

Sorry for that.

> 

> I've made a tweak to special-case early 1.5.x.  

> 

> > Fixes: 85c21e5c3ee74fb75d690c57f7066bae7e2dca55

> > Sighed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>  

> 

> Sighed-off-by indeed, I agree.  It's a good thing there's a lot of beer in

> the fridge...


Heh. Yeah, your changes look OK to me.

Btw, I tried for some time to fix pdf build with Sphinx 1.6 without
much luck. The new table macros version 1.6 adds makes almost
impossible to use adjustbox before a table, because it calls
vskip on them. The solution seems to either redefine those macros
or to override tabulary for it to always call adjustbox.

Unfortunately, I'm not fluent on LaTeX macros, so it takes me a
lot of time to work on it.

I'll try to look on it later, after the merge window.

Regards,
Mauro
diff mbox series

Patch

diff --git a/Documentation/conf.py b/Documentation/conf.py
index 93827bc1620f..3d4e89330044 100644
--- a/Documentation/conf.py
+++ b/Documentation/conf.py
@@ -271,8 +271,6 @@  latex_elements = {
 
 # Additional stuff for the LaTeX preamble.
     'preamble': '''
-	% Adjust margins
-	\\usepackage[margin=0.5in, top=1in, bottom=1in]{geometry}
         \\usepackage{ifthen}
 
         % Allow generate some pages in landscape