Debian Codegraph @

texmf-dist/source/latex/complexpolylongdiv/complexpolylongdiv.dtx

raw
1 % \iffalse
2 %<*internal>
3 \iffalse
4 %</internal>
5 %<*readme>
6 ___________________
7 The complexpolylongdiv package
8 v0.2
9
10 This package provides a simple interface for typesetting
11 (complex) polynomial long division.
12
13 If you want to report any bugs or typos and corrections in the
14 documentation, or ask for any new features, or suggest any
15 improvements, or ask any questions about the package, then
16 please use the issue tracker:
17
18 <https://github.com/xepersian/complexpolylongdiv/issues>
19
20 In doing so, please always explain your issue well enough,
21 and always include a minimal working example showing the
22 issue.
23
24 You may also have conversations, ask questions and post answers
25 without opening issues using the Discussions space:
26
27 <https://github.com/xepersian/complexpolylongdiv/discussions>
28
29 The announcements for the new releases of the package will
30 also appear in the Discussions space under the Announcements
31 category.
32
33 Current version release date: 2024/12/30
34
35 ___________________________________________
36 Vafa Khalighi
37
38 Copyright (c) Vafa Khalighi 2024--2025
39
40 It may be distributed and/or modified under the LaTeX Project Public License,
41 version 1.3c or higher (your choice). The latest version of
42 this license is at: http://www.latex-project.org/lppl.txt
43
44 This work is “author-maintained” (as per LPPL maintenance status)
45 by Vafa Khalighi.
46 %</readme>
47 %<*internal>
48 \fi
49 \begingroup
50 %</internal>
51 %<*batchfile>
52 \input docstrip.tex
53 \keepsilent
54 \preamble
55
56 __________________________________________________
57 Vafa Khalighi
58
59 Copyright (c) 2024--2025 Vafa Khalighi
60
61 It may be distributed and/or modified under the LaTeX Project Public License,
62 version 1.3c or higher (your choice). The latest version of
63 this license is at: http://www.latex-project.org/lppl.txt
64
65 This work is “author-maintained” (as per LPPL maintenance status)
66 by Vafa Khalighi.
67
68
69 \endpreamble
70 \askforoverwritefalse
71 \generate{\file{complexpolylongdiv.sty}{\from{\jobname.dtx}{table,complexpolylongdiv.sty}}}
72 %</batchfile>
73 %<batchfile>\endbatchfile
74 %<*internal>
75 \generate{\file{\jobname.ins}{\from{\jobname.dtx}{batchfile}}}
76 \nopreamble\nopostamble
77 \generate{\file{README.txt}{\from{\jobname.dtx}{readme}}}
78 \generate{\file{complexpolylongdiv-example.tex}{\from{\jobname.dtx}{complexpolylongdiv-example.tex}}}
79 \endgroup
80 \immediate\write18{mv README.txt README}
81 \immediate\write18{makeindex -s gind.ist -o \jobname.ind \jobname.idx}
82 \immediate\write18{makeindex -s gglo.ist -o \jobname.gls \jobname.glo}
83 %</internal>
84 %
85 %<*driver>
86 \documentclass{ltxdoc}
87 \usepackage{complexpolylongdiv}
88 \usepackage{bidicode}
89 \usepackage{microtype}
90 \definecolor{niceblue}{rgb}{0.2,0.4,0.8}
91 \usepackage[numbered]{hypdoc}
92 \hypersetup{%
93 pdfauthor={Vafa Khalighi},%
94 linkcolor=niceblue,%
95 urlcolor=niceblue,%
96 citecolor=niceblue%
97 }
98 \pdfstringdefDisableCommands{%
99 \renewcommand\Lcs[1]{\textbackslash#1}
100 }
101 \EnableCrossrefs
102 \CodelineIndex
103 %\RecordChanges
104 \begin{document}
105 \DocInput{\jobname.dtx}
106 \PrintIndex
107 % \PrintChanges
108 \end{document}
109 %</driver>
110 %
111 %
112 % \fi
113 %
114 % \GetFileInfo{\jobname.dtx}
115 % \title{The \textsf{complexpolylongdiv} Package}
116 % \author{Vafa Khalighi}
117 %\maketitle
118 %
119 %\begingroup
120 %\parindent 0pt
121 %\vskip 0pt plus 3fill
122 %{\color{red!85!black}\fbox{\begin{minipage}{\dimexpr\textwidth-2\fboxsep-2\fboxrule}
123 %If you want to report any bugs or typos and corrections in the documentation,
124 %or ask for any new features, or suggest any improvements, or ask any questions about the package, then please use the issue tracker:
125 %
126 %\medskip
127 % \centerline{\url{https://github.com/xepersian/complexpolylongdiv/issues}}
128 %
129 %\medskip
130 %In doing so, please always explain your issue well enough, and always include
131 %a minimal working example showing the issue.
132 %
133 %\bigskip
134 %You may also have conversations, ask questions and post answers
135 %without opening issues using the Discussions space:
136 %
137 %\medskip
138 % \centerline{\url{https://github.com/xepersian/complexpolylongdiv/discussions}}
139 %
140 %\medskip
141 %The announcements for the new releases of the package will
142 %also appear in the Discussions space under the Announcements
143 %category.
144 %\end{minipage}
145 %}}
146 %
147 %\vskip 0pt plus 3fill
148 %
149 %Copyright (c) 2024--2025 Vafa Khalighi
150 %
151 %\medskip
152 %Permission is granted to distribute and/or modify \emph{both the documentation and the code} under the conditions of the \LaTeX{} Project Public License, either version 1.3c of this license or (at your option) any later version.
153 %\endgroup
154 %
155 %\clearpage
156 % \tableofcontents
157 % \section{Introduction}
158 %To the best of my knowledge, there is no {\TeX} package for
159 %typesetting (complex) polynomial long division. The
160 %\textsf{complexpolylongdiv} package provides a simple interface
161 %for typesetting (complex) polynomial long division.
162 %
163 %The package does not provide automatic (complex) polynomial long
164 %division at present and the long division should be done by hand.
165 %However, if there is enough interest in the package, I will add this
166 %feature in the next version.
167 %
168 %\section{Using the package}
169 %\subsection{Loading The Package}
170 %You can load the package in the ordinary way:
171 %\begin{BDef}
172 %\Lcs{usepackage}\Largb{complexpolylongdiv}
173 %\end{BDef}
174 %\subsection{The user interface}
175 %The package provides the environment \texttt{complexpolylongdiv}
176 %and the control sequence \Lcs{complexpolyquotient} for
177 %typesetting (complex) polynomial long division.
178 %\subsubsection{The \texttt{complexpolylongdiv} environment}
179 %\begin{BDef}
180 %\LBEG{complexpolylongdiv}\OptArg{pos}\quad\Larga{content}\quad\LEND{complexpolylongdiv}
181 %\end{BDef}
182 %
183 %The \OptArg{pos} is optional and determines the vertical alignment of
184 %the (complex) polynomial long division. If \texttt{pos} is \texttt{t}, then
185 %the \Larga{content} is placed vertically at the top and if \texttt{pos} is \texttt{b}, then
186 %the \Larga{content} is placed vertically at the bottom; otherwise,
187 %the \Larga{content} is placed vertically at the center (the default
188 %when the optional \OptArg{pos} is omitted).
189 %
190 %\subsubsection{The control sequence \Lcs{complexpolyquotient}}
191 %\begin{BDef}
192 %\Lcs{complexpolyquotient}\Largb{\Larga{quotient}}
193 %\end{BDef}
194 %
195 %The control sequence \Lcs{complexpolyquotient} typesets \Larga{quotient}.
196 %
197 %\subsection{An Example}
198 %\begin{lstlisting}[gobble=1]
199 %\documentclass{article}
200 %\usepackage{complexpolylongdiv}
201 %\begin{document}
202 %\begin{equation}
203 %\begin{complexpolylongdiv}
204 %&x+1-2i \\
205 %x-1&\complexpolyquotient{x^2-2ix+6}\\
206 %-&\underline{x^2-x}\\
207 % -&(1-2i)x+6\\
208 % -&\underline{(1-2i)x-(1-2i)}\\
209 % &7-2i
210 %\end{complexpolylongdiv}
211 %\end{equation}
212 %\end{document}
213 %\end{lstlisting}
214 %
215 %\begin{equation}
216 %\begin{complexpolylongdiv}
217 %&x+1-2i \\
218 %x-1&\complexpolyquotient{x^2-2ix+6}\\
219 %-&\underline{x^2-x}\\
220 % -&(1-2i)x+6\\
221 % -&\underline{(1-2i)x-(1-2i)}\\
222 % &7-2i\\
223 %\end{complexpolylongdiv}
224 %\end{equation}
225 %
226 % \StopEventually{}
227 % \section{Implementation}
228 %\iffalse
229 %<*table>
230 %\fi
231 %% \CheckSum{52}
232 %% \CharacterTable
233 %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
234 %% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
235 %% Digits \0\1\2\3\4\5\6\7\8\9
236 %% Exclamation \! Double quote \" Hash (number) \#
237 %% Dollar \$ Percent \% Ampersand \&
238 %% Acute accent \' Left paren \( Right paren \)
239 %% Asterisk \* Plus \+ Comma \,
240 %% Minus \- Point \. Solidus \/
241 %% Colon \: Semicolon \; Less than \<
242 %% Equals \= Greater than \> Question mark \?
243 %% Commercial at \@ Left bracket \[ Backslash \\
244 %% Right bracket \] Circumflex \^ Underscore \_
245 %% Grave accent \` Left brace \{ Vertical bar \|
246 %% Right brace \} Tilde \~}
247 %%
248 % \iffalse
249 %</table>
250 %<*complexpolylongdiv.sty>
251 %\fi
252 %
253 %
254 %
255 % \begin{macrocode}
256 \NeedsTeXFormat{LaTeX2e}
257 \ProvidesPackage{complexpolylongdiv}[2024/12/30 v0.2 Typesetting (complex) polynomial long division]
258 \newenvironment{complexpolylongdiv}[1][c]{%
259 \let\\\@arraycr
260 \if #1t
261 \vtop
262 \else
263 \if#1b
264 \vbox
265 \else
266 \vcenter
267 \fi
268 \fi
269 \bgroup
270 \normalbaselines
271 \offinterlineskip
272 \setbox\strutbox\hbox{%
273 \vrule height 2.1ex depth .5ex width0ex}%
274 \tabskip=0pt
275 \halign\bgroup
276 \hfil$##$&$\,\hphantom{\big)}\mkern2mu ##$\hfil\strut\cr
277 }{%
278 \crcr
279 \egroup
280 \egroup
281 }
282 \newcommand*{\complexpolyquotient}[1]{%
283 \omit$\,
284 \overline{%
285 \vphantom{\big)}%
286 \hbox{%
287 \smash{%
288 \raise3.5\fontdimen8\textfont3\hbox{$\big)$}%
289 }%
290 }%
291 \mkern2mu #1
292 }$%
293 }
294 % \end{macrocode}
295 % \iffalse
296 %</complexpolylongdiv.sty>
297 %\fi
298 %
299 % \Finale
300 %
301 %
302 %\iffalse
303 %<*complexpolylongdiv-example.tex>
304 \documentclass{article}
305 \usepackage{complexpolylongdiv}
306 \begin{document}
307 \begin{equation}
308 \begin{complexpolylongdiv}
309 &x+1-2i \\
310 x-1&\complexpolyquotient{x^2-2ix+6}\\
311 -&\underline{x^2-x}\\
312 -&(1-2i)x+6\\
313 -&\underline{(1-2i)x-(1-2i)}\\
314 &7-2i
315 \end{complexpolylongdiv}
316 \end{equation}
317 \end{document}
318 %</complexpolylongdiv-example.tex>
319 %\fi
320 %
321 % \typeout{*************************************************************}
322 % \typeout{*}
323 % \typeout{* To finish the installation you have to move the file}
324 % \typeout{* `complexpolylongdiv.sty' into a directory searched by TeX.}
325 % \typeout{*************************************************************}
326 %
327 \endinput