-
Notifications
You must be signed in to change notification settings - Fork 0
/
landscapefix.tex
44 lines (44 loc) · 1.38 KB
/
landscapefix.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
% copied from https://stackoverflow.com/questions/4982219/how-to-make-landscape-mode-rotate-properly-in-a-twoside-book/5320962#5320962
\makeatletter
\global\let\orig@begin@landscape=\landscape%
\global\let\orig@end@landscape=\endlandscape%
\gdef\@true{1}
\gdef\@false{0}
\gdef\landscape{%
\global\let\within@landscape=\@true%
\orig@begin@landscape%
}%
\gdef\endlandscape{%
\orig@end@landscape%
\global\let\within@landscape=\@false%
}%
\@ifpackageloaded{pdflscape}{%
\gdef\pdf@landscape@rotate{\PLS@Rotate}%
}{
\gdef\pdf@landscape@rotate#1{}%
}
\let\latex@outputpage\@outputpage
\def\@outputpage{
\ifx\within@landscape\@true%
\if@twoside%
\ifodd\c@page%
\gdef\LS@rot{\setbox\@outputbox\vbox{%
\pdf@landscape@rotate{-90}%
\hbox{\rotatebox{90}{\hbox{\rotatebox{180}{\box\@outputbox}}}}}%
}%
\else%
\gdef\LS@rot{\setbox\@outputbox\vbox{%
\pdf@landscape@rotate{+90}%
\hbox{\rotatebox{90}{\hbox{\rotatebox{0}{\box\@outputbox}}}}}%
}%
\fi%
\else%
\gdef\LS@rot{\setbox\@outputbox\vbox{%
\pdf@landscape@rotate{+90}%
\hbox{\rotatebox{90}{\hbox{\rotatebox{0}{\box\@outputbox}}}}}%
}%
\fi%
\fi%
\latex@outputpage%
}
\makeatother