Browse Source

fix setspace bug

master
Jonathan Spratte 10 months ago
parent
commit
cfbe9723af
2 changed files with 78 additions and 6 deletions
  1. 39
    3
      MRTalone/MRTalone.cls
  2. 39
    3
      MRTthesis/MRTthesis.cls

+ 39
- 3
MRTalone/MRTalone.cls View File

@@ -1,5 +1,5 @@
1
-\newcommand*\MRTalone@version{0.0.9}
2
-\newcommand*\MRTalone@date{2018-08-16}
1
+\newcommand*\MRTalone@version{0.0.10}
2
+\newcommand*\MRTalone@date{2020-03-02}
3 3
 
4 4
 \NeedsTeXFormat{LaTeX2e}
5 5
 
@@ -181,7 +181,7 @@
181 181
 %%=============================================================================
182 182
 \setlength{\arrayrulewidth}{0.6pt}
183 183
 \setlength{\parindent}{13pt} % default 15pt
184
-\setlength{\parskip}{6pt plus 6pt minus 1pt}
184
+\setlength{\parskip}{6pt plus .3pt minus .15pt}
185 185
 \setlength{\mathindent}{10.45mm}
186 186
 \AtBeginDocument
187 187
   {
@@ -192,6 +192,42 @@
192 192
   }
193 193
 \setlist[itemize]{itemsep=-0pt, parsep=2pt plus .2pt minus .1pt}
194 194
 \setlist[enumerate]{itemsep=-0pt, parsep=2pt plus .2pt minus .1pt}
195
+% we need to fix an issue that setspace introduces, making the display skips
196
+% unstretchable. Code from https://tex.stackexchange.com/a/523552/117050
197
+\MRTutil@def\MRTalone@addstretchshrink#1%
198
+  {%
199
+    \if\relax\displayskipstretch\relax
200
+      % there is no factor, don't add plus and minus
201
+    \else
202
+      plus \displayskipstretch\gluestretch#1
203
+      minus \displayskipstretch\glueshrink#1
204
+    \fi
205
+  }
206
+\AtBeginDocument
207
+  {%
208
+    \begingroup
209
+    \def\fix#1\abovedisplayskip#2\displayskipstretch\belowdisplayshortskip#3\fix
210
+      {%
211
+        \endgroup
212
+        \everydisplay
213
+          {%
214
+            #1#3%
215
+            \abovedisplayskip=%
216
+              \displayskipstretch       \abovedisplayskip
217
+              \MRTalone@addstretchshrink\abovedisplayskip
218
+            \belowdisplayskip=%
219
+              \displayskipstretch       \belowdisplayskip
220
+              \MRTalone@addstretchshrink\belowdisplayskip
221
+            \abovedisplayshortskip=%
222
+              \displayskipstretch       \abovedisplayshortskip
223
+              \MRTalone@addstretchshrink\abovedisplayshortskip
224
+            \belowdisplayshortskip=%
225
+              \displayskipstretch       \belowdisplayshortskip
226
+              \MRTalone@addstretchshrink\belowdisplayshortskip
227
+          }%
228
+      }%
229
+    \expandafter\fix\the\everydisplay\fix
230
+  }
195 231
 %%===========================================================================<<
196 232
 
197 233
 %% set page dimensions >>=

+ 39
- 3
MRTthesis/MRTthesis.cls View File

@@ -1,5 +1,5 @@
1
-\newcommand*\MRTthesis@version{0.0.22}
2
-\newcommand*\MRTthesis@date{2019-12-16}
1
+\newcommand*\MRTthesis@version{0.0.23}
2
+\newcommand*\MRTthesis@date{2020-03-02}
3 3
 
4 4
 \NeedsTeXFormat{LaTeX2e}
5 5
 
@@ -593,7 +593,7 @@
593 593
 %%=============================================================================
594 594
 \setlength{\arrayrulewidth}{0.6pt}
595 595
 \setlength{\parindent}{13pt} % default 15pt
596
-\setlength{\parskip}{6pt plus 6pt minus 1pt}
596
+\setlength{\parskip}{6pt plus .3pt minus .15pt}
597 597
 \setlength{\mathindent}{10.45mm}
598 598
 \AtBeginDocument
599 599
   {
@@ -604,6 +604,42 @@
604 604
   }
605 605
 \setlist[itemize]{itemsep=-0pt, parsep=2pt plus .2pt minus .1pt}
606 606
 \setlist[enumerate]{itemsep=-0pt, parsep=2pt plus .2pt minus .1pt}
607
+% we need to fix an issue that setspace introduces, making the display skips
608
+% unstretchable. Code from https://tex.stackexchange.com/a/523552/117050
609
+\MRTutil@def\MRTthesis@addstretchshrink#1%
610
+  {%
611
+    \if\relax\displayskipstretch\relax
612
+      % there is no factor, don't add plus and minus
613
+    \else
614
+      plus \displayskipstretch\gluestretch#1
615
+      minus \displayskipstretch\glueshrink#1
616
+    \fi
617
+  }
618
+\AtBeginDocument
619
+  {%
620
+    \begingroup
621
+    \def\fix#1\abovedisplayskip#2\displayskipstretch\belowdisplayshortskip#3\fix
622
+      {%
623
+        \endgroup
624
+        \everydisplay
625
+          {%
626
+            #1#3%
627
+            \abovedisplayskip=%
628
+              \displayskipstretch        \abovedisplayskip
629
+              \MRTthesis@addstretchshrink\abovedisplayskip
630
+            \belowdisplayskip=%
631
+              \displayskipstretch        \belowdisplayskip
632
+              \MRTthesis@addstretchshrink\belowdisplayskip
633
+            \abovedisplayshortskip=%
634
+              \displayskipstretch        \abovedisplayshortskip
635
+              \MRTthesis@addstretchshrink\abovedisplayshortskip
636
+            \belowdisplayshortskip=%
637
+              \displayskipstretch        \belowdisplayshortskip
638
+              \MRTthesis@addstretchshrink\belowdisplayshortskip
639
+          }%
640
+      }%
641
+    \expandafter\fix\the\everydisplay\fix
642
+  }
607 643
 %%===========================================================================<<
608 644
 
609 645
 %% sectioning commands >>=

Loading…
Cancel
Save