Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sphinxmaketitle should use \linewidth not \textwidth for his ruler #10363

Closed
LuisBL opened this issue Apr 18, 2022 · 1 comment
Closed

sphinxmaketitle should use \linewidth not \textwidth for his ruler #10363

LuisBL opened this issue Apr 18, 2022 · 1 comment
Labels

Comments

@LuisBL
Copy link

LuisBL commented Apr 18, 2022

Describe the bug

If we configure latepdf to be twocolum with this in conf.py:

latex_elements = {  
    'classoptions': ',twocolumn',    # to have two columns 
    }  

we got twocolumn in _build/latex/proj.tex

  %% Generated by Sphinx.    
  \def\sphinxdocclass{article}
  \documentclass[a4paper,10pt,twocolumn,french]{sphinxhowto}

It work well but the

How to Reproduce

$ python3 -m venv ~/venv ; . ~/venv/bin/activate 
$ pip install sphinx
$ sphinx-quickstart    # answer default to all questions      

To have laxtex A4, article with control on margins and 2 columns: add this to conf.py:

    # -- Options for LaTeX output --------------------------------
    latex_elements = {    
      'papersize': 'a4paper',  # 'letterpaper' or 'a4paper'      
      'pointsize': '10pt',     # font size (default is 10pt)
      'sphinxsetup': 'hmargin={1.5cm,1.5cm}, vmargin={2cm,2cm}', 
      'classoptions': ',twocolumn',    # to have two columns 
      }    
    latex_theme = 'howto'  # 'manual' to make a book, 'howto' to make an article 

Crate some rst files::

    $ mkdir -p src 
    $ vim src/antiquite.rst src/ src/moderne.rst  

Then we need to define the main TOC table of content in the main index.rst file, this TOC file will refer to rst files to include in the document::

    $ cat index.rst    
    Exposé 
    ===============

    .. toctree::      
       :maxdepth: 3      
       :caption: Table des Matieres:   
                                                                                                      
       /src/antiquite.rst
       /src/moderne.rst 
    $     

call:

$ make pdflatex`
$ evince _build/latex/proj.pdf

Expected behavior

the ruller maketitle should not take all the width but only the column widht

Your project

https://github.com/sphinx-doc/sphinx/

Screenshots

Sélection_927

OS

Linux Ubuntu 20.04

Python version

Python 3.8.10

Sphinx version

4.3.2

Sphinx extensions

No response

Extra tools

No response

Additional context

No response

@LuisBL
Copy link
Author

LuisBL commented Apr 18, 2022

This patch work well to fix the problem:

(venv) luis@spinoza:~/proj/g/alien/sphinx/sphinx/texinputs$ git diff
diff --git a/sphinx/texinputs/sphinxhowto.cls b/sphinx/texinputs/sphinxhowto.cls
index 951cf810d..5b19e8284 100644
--- a/sphinx/texinputs/sphinxhowto.cls
+++ b/sphinx/texinputs/sphinxhowto.cls
@@ -42,7 +42,7 @@
 % ``Bjarne'' style a bit better.
 %
 \newcommand{\sphinxmaketitle}{%
-  \noindent\rule{\textwidth}{1pt}\par
+    \noindent\rule{\linewidth}{1pt}\par
     \begingroup % for PDF information dictionary
        \def\endgraf{ }\def\and{\& }%
        \pdfstringdefDisableCommands{\def\\{, }}% overwrite hyperref setup
@@ -74,7 +74,7 @@
     \sphinxtableofcontentshook
     \tableofcontents
   \endgroup
-  \noindent\rule{\textwidth}{1pt}\par
+  \noindent\rule{\linewidth}{1pt}\par
   \vspace{12pt}%
 }
 \newcommand\sphinxtableofcontentshook{}
(venv) luis@spinoza:~/proj/g/alien/sphinx/sphinx/texinputs$ 

@jfbu jfbu closed this as completed in 6487529 May 8, 2022
jfbu added a commit that referenced this issue May 8, 2022
…e-linewidth-fix

fix #10363 make sphinxmaketitle ruler use \linewidth not \textwidth
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant