summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/kotex-oblivoir/memhangul-x/xob-lwarp.sty
blob: bbfea75956dc95421717f48ed3f3e3263f36ca44 (plain)
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
%% xob-lwarp.sty
%%
%% part of xoblivoir package bundle
%% 2020/02/09
%%
\ProvidesPackage{xob-lwarp}

\if@lwarp
	\def\makerunningwidth#1#2{%
		\expandafter\let\csname #1headrunwidth\endcsname\textwidth
		\expandafter\let\csname #1footrunwidth\endcsname\textwidth
	}
	\def\makeheadposition#1#2#3#4#5{}
	\def\copypagestyle#1#2{\makepagestyle{#1}}
	\AtBeginDocument{
		\def\@partapp{Part}
		\def\@chapapp{Chapter}
	}
	\AtEndPreamble{
		\HTMLLanguage{\LWARPlan}
	}
	
	\let\if@bsstyle\iftrue
	\let\abstitlestyle\textbf
%
	%%%% copy-paste from xetexko-vertical.sty
	\ifxetex
	% do not veticalize headline/footline
	\begingroup\expandafter\expandafter\expandafter\endgroup
	\expandafter\ifx\csname selectfont\endcsname\relax % plain
	  \protected\def\verticaltypesetting{%
	    \dimen@\hsize\hsize\vsize\vsize\dimen@
	    \edef\plainoutput{\unexpanded{\dimen@\hsize\hsize\vsize\vsize\dimen@}%
	      \unexpanded\expandafter{\plainoutput}}%
	    \def\pagebody{\setbox\z@\vbox to\hsize{\boxmaxdepth=\maxdepth
	      \pagecontents}\xetexko@rotatebox\z@\box\z@}%
	    \maxdepth\z@ \XK@vertical@spacing}
	\else % latex
	  \protected\def\verticaltypesetting{%
	    \AtBeginDocument{\XK@vertical@spacing}%
	    \maxdepth\z@
	    \dimen@\textwidth
	    \textwidth\textheight
	    \textheight\dimen@
	    \edef\@outputpage{%
	      \unexpanded{\xetexko@rotatebox\@outputbox\textwidth\textheight}%
	      \unexpanded\expandafter{\@outputpage}}%
	  }
	  \@onlypreamble\verticaltypesetting
	\fi
	
	\def\xetexko@rotatebox#1{%
	  \ifvbox#1\count@\@ne\else\count@\z@\fi
	  \dimen@\wd#1\dimen@ii\dimexpr\ht#1+\dp#1\relax
	  \setbox#1\ifnum\count@=\@ne
	  \vbox to\dimen@\bgroup\hbox to\dimen@ii\bgroup\hfil\else
	  \hbox to\dimen@ii\bgroup\vbox to\dimen@\bgroup\fi
	    \wd#1\z@ \ht#1\z@ \dp#1\z@
	    \special{x:gsave}\special{x:rotate -90}\box#1\special{x:grestore}%
	    \ifnum\count@=\@ne\egroup\vfil\else\vfil\egroup\hfil\fi\egroup
	}
	
	% users can declare vertical EM size, which might be different from 1em.
	\newdimen\verticalem
	
	\def\XK@vertical@spacing{%
	  \ifnum\verticalem > \z@
	    \def\XK@vert@half@em{.5\verticalem}%
	  \else
	    \def\XK@vert@half@em{.5em}%
	  \fi
	  \let\xk@horiz@precjkopenparen \precjkopenparen
	  \let\xk@horiz@precjkcloseparen\precjkcloseparen
	  \let\xk@horiz@precjkfullstop  \precjkfullstop
	  \ifx\precjkopenparen\relax\else
	    \def\precjkopenparen {\leavevmode
	      \ifx\empty\xetexkocharraise\else\raise\xetexkocharraise\fi
	      \hbox
	      \ifx\XKdisablecjksymbolspacing\empty
	        \bgroup
	      \else
	        to\XK@vert@half@em \bgroup \hss
	      \fi
	    }%
	  \fi
	  \ifx\precjkcloseparen\relax\else
	    \def\precjkcloseparen{\leavevmode
	      \ifx\empty\xetexkocharraise\else\raise\xetexkocharraise\fi
	      \hbox
	      \ifx\XKdisablecjksymbolspacing\empty\else
	        to\XK@vert@half@em
	      \fi
	      \bgroup}%
	  \fi
	  \ifx\precjkfullstop\relax\else
	    \def\precjkfullstop  {\leavevmode
	      \ifx\empty\xetexkocharraise\else\raise\xetexkocharraise\fi
	      \hbox
	      \ifx\XKdisablecjksymbolspacing\empty\else
	        to\XK@vert@half@em
	      \fi
	      \bgroup}%
	  \fi
	  \spaceskip\XK@vert@half@em plus\XK@vert@half@em\relax
	  \parindent\XK@vert@half@em \parindent2\parindent
	}
	
	\protected\def\vertical#1{%
	  \setbox\z@\vbox\bgroup
	    \hsize=#1%
	    \leftskip\z@
	    \rightskip\z@
	    \parindent\z@
	    \everypar{}%
	    \XK@vertical@spacing
	}
	
	\protected\def\endvertical{%
	  \egroup
	  \dimen@\dimexpr\ht\z@+\dp\z@\relax
	  \dimen@ii\dimexpr\wd\z@-\dp\z@\relax
	  \setbox\z@\hbox{%
	    \kern\dimexpr\ht\z@+0.5em\relax
	    \wd\z@\z@
	    \ht\z@\z@
	    \dp\z@\z@
	    \special{x:gsave}%
	    \special{x:rotate -90}%
	    \box\z@
	    \special{x:grestore}}%
	  \wd\z@\dimen@
	  \ht\z@\z@
	  \dp\z@\z@
	  \leavevmode
	  \raise\dimen@ii\box\z@
	}
	
	% horizontal box inside vertical typesetting
	\protected\def\horizontal#1{%
	  \setbox\z@\vbox\bgroup
	    \hsize=#1%
	    \leftskip \z@
	    \rightskip\z@
	    \parindent\z@
	    \everypar {}%
	    \spaceskip     \fontdimen2\font
	              plus \fontdimen3\font
	              minus\fontdimen4\font
	    \ifdefined\xk@horiz@precjkopenparen
	      \let\precjkopenparen \xk@horiz@precjkopenparen
	      \let\precjkcloseparen\xk@horiz@precjkcloseparen
	      \let\precjkfullstop  \xk@horiz@precjkfullstop
	    \fi
	}
	\protected\def\endhorizontal{%
	  \egroup
	  \dimen@\dimexpr\ht\z@+\dp\z@\relax
	  \dimen@ii\dimexpr\wd\z@+.5ex\relax
	  \setbox\z@\hbox\bgroup
	    \wd\z@\z@\ht\z@\z@\dp\z@\z@
	    \special{x:gsave}%
	    \special{x:rotate 90}%
	    \box\z@
	    \special{x:grestore}%
	  \egroup
	  \wd\z@\dimen@
	  \ht\z@\dimen@ii
	  \dp\z@\z@
	  \fboxsep=-\fboxrule
	  \leavevmode\lower.5ex\box\z@
	}
	
	\protected\def\vertlatin#1{\leavevmode\lower0.5ex\hbox{\latinmarks #1}}
	\fi % end of vertical
\fi
\endinput