From fe9b884c5e585af7c8186b6ea4a234d88305c93b Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Fri, 13 Oct 2023 17:04:41 +0200 Subject: [PATCH 1/4] Improve print style * Remove header. * Remove TOC sidebar. * Remove sidebar header if closed. * Use appropriate page margins and max-width. * Remove underlines from links and abbreviations. * Use more compact headings. --- pep_sphinx_extensions/pep_theme/static/mq.css | 53 ++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/pep_sphinx_extensions/pep_theme/static/mq.css b/pep_sphinx_extensions/pep_theme/static/mq.css index 7977585e61f..5e35177051f 100644 --- a/pep_sphinx_extensions/pep_theme/static/mq.css +++ b/pep_sphinx_extensions/pep_theme/static/mq.css @@ -89,7 +89,7 @@ max-width: 100% !important; } @page { - margin: 0.5cm; + margin: 2.5cm; } p, h2, @@ -102,4 +102,55 @@ h3 { page-break-after: avoid; } + h1 { + font-size: 18pt; + font-weight: bold; + text-align: center; + } + h2, details > summary { + font-size: 15pt; + font-weight: normal; + } + h3 { + font-size: 13pt; + font-weight: normal; + } + h4 { + font-size: 10pt; + font-weight: 600; + } + a, abbr { + text-decoration: none; + } + + details { + display: none; + } + details[open] { + display: block; + } + + h1.page-title:first-child { + margin-top: 0; + } + + section#pep-page-section { + display: flex; + justify-content: center; + padding: 0; + margin: 0 auto; + } + + section#pep-page-section > header, + nav#pep-sidebar { + display: none; + } + + section#pep-page-section > article { + float: none; + max-width: 17.5cm; + width: auto; + margin: 0; + padding: 0; + } } From fcd55f75f194df6bca1fe82233c4ba7d80dbb344 Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Wed, 18 Oct 2023 22:19:45 +0200 Subject: [PATCH 2/4] Use page margins according to DIN 5008 --- pep_sphinx_extensions/pep_theme/static/mq.css | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pep_sphinx_extensions/pep_theme/static/mq.css b/pep_sphinx_extensions/pep_theme/static/mq.css index 5e35177051f..097c28adb94 100644 --- a/pep_sphinx_extensions/pep_theme/static/mq.css +++ b/pep_sphinx_extensions/pep_theme/static/mq.css @@ -88,8 +88,18 @@ img { max-width: 100% !important; } + /* Page margins according to DIN 5008, leaves space for punched holes. */ @page { - margin: 2.5cm; + margin-top: 2cm; + margin-bottom: 2cm; + } + @page :right { + margin-left: 2.5cm; + margin-right: 2cm; + } + @page :left { + margin-left: 2cm; + margin-right: 2.5cm; } p, h2, From 69663417aa0e160f1970872e97f11aaa7c93b4d6 Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Wed, 18 Oct 2023 22:30:32 +0200 Subject: [PATCH 3/4] Use same margin left and right --- pep_sphinx_extensions/pep_theme/static/mq.css | 6 ------ 1 file changed, 6 deletions(-) diff --git a/pep_sphinx_extensions/pep_theme/static/mq.css b/pep_sphinx_extensions/pep_theme/static/mq.css index 097c28adb94..dc0fffe5615 100644 --- a/pep_sphinx_extensions/pep_theme/static/mq.css +++ b/pep_sphinx_extensions/pep_theme/static/mq.css @@ -92,13 +92,7 @@ @page { margin-top: 2cm; margin-bottom: 2cm; - } - @page :right { margin-left: 2.5cm; - margin-right: 2cm; - } - @page :left { - margin-left: 2cm; margin-right: 2.5cm; } p, From 9961a7a1b77315bda0c69e6aea3c4014788b30cc Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Wed, 18 Oct 2023 22:39:39 +0200 Subject: [PATCH 4/4] Fix small white box on each page --- pep_sphinx_extensions/pep_theme/static/mq.css | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pep_sphinx_extensions/pep_theme/static/mq.css b/pep_sphinx_extensions/pep_theme/static/mq.css index dc0fffe5615..2609a959ebd 100644 --- a/pep_sphinx_extensions/pep_theme/static/mq.css +++ b/pep_sphinx_extensions/pep_theme/static/mq.css @@ -157,4 +157,9 @@ margin: 0; padding: 0; } + + /* This blocks a small portion on each page. */ + readthedocs-flyout { + display: none; + } }