From 1903b598f8dda613f5c584bb18ccfd2fd8c278bb Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Tue, 4 Jan 2022 03:01:50 +0000 Subject: CTAN sync 202201040301 --- macros/latex/contrib/wrapfig2/README.txt | 2 +- macros/latex/contrib/wrapfig2/wrapfig2.dtx | 150 +++++------ macros/latex/contrib/wrapfig2/wrapfig2.pdf | Bin 511808 -> 532255 bytes macros/latex/contrib/yb-book/DEPENDS.txt | 33 +++ macros/latex/contrib/yb-book/README.md | 25 ++ macros/latex/contrib/yb-book/samples/sample.tex | 41 +++ macros/latex/contrib/yb-book/yb-book-logo.pdf | Bin 0 -> 5216 bytes macros/latex/contrib/yb-book/yb-book.cls | 341 ++++++++++++++++++++++++ macros/latex/contrib/yb-book/yb-book.pdf | Bin 0 -> 239404 bytes macros/latex/contrib/yb-book/yb-book.tex | 79 ++++++ 10 files changed, 595 insertions(+), 76 deletions(-) create mode 100644 macros/latex/contrib/yb-book/DEPENDS.txt create mode 100644 macros/latex/contrib/yb-book/README.md create mode 100644 macros/latex/contrib/yb-book/samples/sample.tex create mode 100644 macros/latex/contrib/yb-book/yb-book-logo.pdf create mode 100644 macros/latex/contrib/yb-book/yb-book.cls create mode 100644 macros/latex/contrib/yb-book/yb-book.pdf create mode 100644 macros/latex/contrib/yb-book/yb-book.tex (limited to 'macros/latex') diff --git a/macros/latex/contrib/wrapfig2/README.txt b/macros/latex/contrib/wrapfig2/README.txt index 38d2c8a284..c6f5011111 100644 --- a/macros/latex/contrib/wrapfig2/README.txt +++ b/macros/latex/contrib/wrapfig2/README.txt @@ -1,5 +1,5 @@ %%%% README.txt file -This README.txt for package wrapfig2[2021-12-25 v.4.0 ...] +This README.txt for package wrapfig2[2022-01-03 v.4.0.1 ...] This work is author maintained diff --git a/macros/latex/contrib/wrapfig2/wrapfig2.dtx b/macros/latex/contrib/wrapfig2/wrapfig2.dtx index 5b6d9f8813..36b142c967 100644 --- a/macros/latex/contrib/wrapfig2/wrapfig2.dtx +++ b/macros/latex/contrib/wrapfig2/wrapfig2.dtx @@ -45,7 +45,7 @@ wrapfig2.sty and wrapfig2.pdf, plus the auxiliary file README.txt. %<+package>\ProvidesPackage{wrapfig2}% %^^A<+readme>File README.txt for package wrapfig2 %<*package|readme> - [2021-12-21 v.4.0 Wrapfig extended] + [2022-01-03 v.4.0.1 Wrapfig extended] % %<*driver> % @@ -217,25 +217,27 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi % % The original software had some idiosyncrasies; Donald Arseneau % described them in the documentation of his package; I am sorry -% to say that such idiosyncrasies have not been reduced; but in any case -% the solution is to wrap the inserted object with a sufficient -% number of lines, i.e. by a sufficiently long paragraph. -% -% The above implies that no wrapped object code should be inserted -% by the end of a paragraph; again no object code should be inserted -% within any list; not even close to the end or to the -% beginning of section. Arseneau's code is capable of +% to say that such idiosyncrasies have not been reduced; but in +% any case in order to avoid such peculiar anomalies, it is +% sufficient to wrap the inserted object with a reasonable +% number of lines, i.e. by a reasonably long paragraph. +% +% The above implies that no wrapped object code should be specified +% in the source file close the end of a paragraph; again no object +% code should be inserted within any list; not even close to the end +% or to the beginning of section. Arseneau's code is capable of % specifying the wrapping number of lines such that two or more % paragraphs can be indented so as to wrap a longish insertion, % but it is wise to avoid such risky situations. Moreover, if the % inserted figure or table has a numbered caption, the number might -% not result in the correct order with the normal corresponding +% not result in the correct sequence of the normal corresponding % floating objects. % % Therefore the usefulness of the wrapping procedure depends very % much from the document author ability to move around his/her code % until a suitable position is found. Certainly a good place is -% within a longish first section at the beginning of a new chapter. +% within a longish first section paragraph at the beginning of a +% new chapter. % % The code of this package does not do anything to correct such % idiosyncrasies. They are caused by the limitations of the @@ -246,17 +248,17 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi % \meta{number of indented lines} argument does not mean the total % number, but the correction number to add-to or subtract-from to the % value computed by the default mechanism devised by Arseneau. We assume -% that any user first uses the software to insert an object to be wrapped +% that all user first use the software to insert an object to be wrapped % by the surrounding text without specifying any value with the -% specific optional argument; then evaluates the result, and if the +% specific optional argument; then they evaluate the result, and if the % space below the wrapped object is too large, or if such space is -% too small s/he counts the necessary number of lines and specifies +% too small they count the necessary number of lines and specify % it to be processed during another document compilation. When the % object to be wrapped is tall, it is very easy to miscount the % necessary number of lines, while is is very easy to evaluate the % necessary small correction to the default computed value. % -% A third purpose of this package is to define a new environment, +% A furher purpose of this package is to define a new environment, % \Env{wraptext}, to wrap a framed text block typeset on a grey % background as if it were a figure. On \texttt{texstackexchange} % a solution was suggested to a user who was asking for such an @@ -269,11 +271,11 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi % of the indented lines number would still be necessary. We added also % the possibility of optionally specifying the measure of the % wrapped text, even if this measure should not be too different -% from a half of the wrapping text measure: with a value too different -% from \texttt{0.5\cs{linewidth}} either the wrapped text has problems -% with inter word spaces and hyphenation because of the small measure, -% or, on the opposite, the indented lines of the wrapping text have -% similar problems. +% from a half of the wrapping text measure.In facts, with a value too +% different from \texttt{0.5\cs{linewidth}} either the wrapped text has +% problems with inter word spaces and hyphenation because of the small +% measure, or, on the opposite, the indented lines of the wrapping text +% have similar problems. % %^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % \section{Environment syntax} @@ -312,7 +314,7 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi %\section{Examples} %^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % We display some examples by using fake objects such that suitably -% long paragraphs are available; some fake language long paragraphs are +% long paragraphs are available; some fake-language long-paragraphs are % obtained by means of the \pack{kantlipsum} package functionalities. % They contain paragraphs that look as Kant's sentences, but we % doubt that Immanuel Kant ever wrote such texts\dots @@ -322,7 +324,7 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi %^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % -%\begin{wrapfigure}{r}{50mm}* +%\begin{wrapfigure}{r}{50mm} %\centering\unitlength=1mm %\begin{picture}(40,30) %\polygon(0,0)(40,0)(40,30)(0,30) @@ -362,11 +364,11 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi % case a \cs{centering} command might help to center the table % within the indention of the wrapping text. Nevertheless the % software can compute the object width if a zero value is specified -% or if the mandatory \meta{width} parameter is completely omitted; -% this second possibility is a feature of this package, that uses a -% \LaTeXiii property by which even a braced argument can be treated -% as an optional argument with a predefined default value; see below -% more details about this feature. +% or if the \meta{width} parameter is completely omitted together +% with its braces; this second possibility is a feature of this +% package, that uses a \LaTeXiii property by which even a braced +% argument can be treated as an optional argument with a predefined +% default value; see below more details about this feature. % %\begin{wraptable}{l} %\centering @@ -404,9 +406,9 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi % this width parameter might yield better looking results. % % On the opposite if the user estimates that the table with its -% caption might use 5 lines, and specified such a value as the +% caption might use 5~lines, and specified such a value as the % first (optional) argument to the environment, the result would -% be this poor one, with the last caption line overlapping the +% be the following poor one, with the last caption line overlapping the % wrapping text. % %\begin{wraptable}[5]{l} @@ -421,8 +423,6 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi %\end{wraptable} %\kant[2] % -% If -% %^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % \subsection{A wrapped text} %^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -524,7 +524,7 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi % and its default value amounts to half the current measure; it can % be specified but it should not be too different from 50\% the % current measure. For the standard environments this parameter value -% is mandatory, but, we recall, for the redefined environments +% is mandatory, but, we recall, only for the redefined environments % \env{wrapfigure} and \env{wraptable}, this braced argument is optional. % %^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -532,20 +532,19 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi %^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Pictures and textual arrays may be floated by means of the standard % \amb{figure} and \amb{table} environments. But other floating -% objects may be defined by means of the \pack{float} package, -% just to name one, or classes. Besides floating, the main difference -% is the name of the caption “label”: Figure, Table, Algorithm, -% Example, and so on. +% objects may be defined by means of other packages, for example the +% \pack{float}, or classes, such as \class{memoir}. Besides floating, +% the main difference is the name of the caption “label”: Figure, Table, +% Algorithm, Example, and so on. % % If floating is not necessary, this package (as well as the original % one) allows to use the underlying environment \Env{wrapfloat} % that uses the same syntax as \Env{wrapfigure} plus the mandatory % name of the new object: even a figure might be introduced without % using \amb{wrapfigure}, by using instead: -%\begin{flushleft}\ttfamily\obeylines -%\Benv{wrapfloat}\Marg{figure}\oarg{line number}\marg{placement}\% -%\quad \oarg{overhang}\marg{width}\meta{$\star$} -%\qquad\qquad\meta{image} +%\begin{flushleft}\setfontsize{9.275}\ttfamily\obeylines +%\Benv{wrapfloat}\Marg{figure}\oarg{line number}\marg{placement}\oarg{overhang}\marg{width}\meta{$\star$} +%\quad\qquad\meta{image} %\Eenv{wrapfloat} %\end{flushleft} % Another \meta{object} may be wrapped by using: @@ -588,7 +587,7 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi %\begin{quote} % Most, but not all, of the argument types defined by \pack{xparse} % are now supported at the kernel level. In particular, the types -% \texttt{g/G}, \texttt{l} and \texttt{u} are not provided by the +% \texttt{g/G}, \texttt{l} and \texttt{u}, are not provided by the % kernel code; these are \emph{deprecated} but still available by % explicitly loading \pack{xparse}. All other argument types are % now available directly within the \LaTeXe kernel. @@ -649,10 +648,10 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi % and \pack{xfp} packages before loading \pack{wrapfig2}. % Notice that most of the \pack{xparse} package functionalities % at the date required for the format file are already included. The -% \pack{xparse} package has been available about in 2018; should the user -% have available a definitely older \TeX system installation, s/he +% \pack{xparse} package has been available about in 2018; should the users +% have available a definitely older \TeX system installation, they % should upgrade it, or must avoid using this \pack{wrapfig2} package -% and use the original one; if s/he needs to wrap text, s/he should +% and use the original one; if they need to wrap text, they should % resort to some ingenious tricks to do it. % % The opening command of the \Env{wrapfloat} environment receives @@ -696,10 +695,10 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi % to be wrapped, that does not have a specific width; moreover the % inserted text must not be too wide, nor too short in order to avoid % problems for its justification or the justification of the wrapping -% text. The framed box width is preset to 50\% of the normal text measure, -% but it can be optionally specified to a different value (not too -% different from 50\%), while for the other environments the wrapped -% material width is an \emph{optional braced parameter}. +% lines. The framed box width is preset to 50\% of the normal text +% measure, but it can be optionally specified to a different value (not +% too different from 50\%), while for the other environments the wrapped +% material width is an \emph{braced optional parameter}. % % For what concerns the \Env{wraptext} environment, see below, % because the code is a little more complicated and requires some @@ -709,23 +708,26 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi % because the computation of the insertion block height is pretty % precise and at most the user might desire one line more or less % depending on the measure of the whole text, and that of the -% inserted block and/or the measure of the indented wrapped lines. +% inserted block and/or the measure of the indented wrapped lines; +% sometimes it might be necessary to get rid of the space below the +% inserted block when it gets typeset at the bottom of a page. % % It is true that some of the input parameters specified to the opening -% command with \LaTeXiii are available also to the closing commands; see -% the last paragraph of section~2 in the \pack{xparse} documentation. +% command of any environment with \LaTeXiii are available also to the +% closing commands; see the last paragraph of section~2 in the +% \pack{xparse} documentation. % But the following definition, besides using special delimiters for % optional parameters, uses the separate opening and closing % macros of the \Env{wrapfloat} environment; such procedure % apparently breaks this second availability of the input parameters, % therefore it is necessary to save them into local macros or count -% registers (assignments of \TeX count registers are \emph{local}, -% while assignment of the \LaTeX\ named counters, through the +% registers (assignments to \TeX count registers are \emph{local}, +% while assignment to \LaTeX\ named counters, through the % \cs{setcounter} macro and its siblings, are \emph{global}) so % that we can use their values within the closing commands. % -% The \cs{NWF@box} has been assigned at the beginning; remember -% that \LaTeXiii registers of any kind are not limited in number +% The \cs{NWF@box} box register has been assigned at the beginning; +% remember that \LaTeXiii registers of any kind are not limited in number % as they were some years ago even with \LaTeXe. % The last opening commands are conceived to box the object to be % wrapped, typeset within a \Env{minipage} with the default or @@ -785,7 +787,7 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi % arguments. % % The main function of this environment is to handle the box that -% contains the figure, or the table, or the framed test, or what +% contains the figure, or the table, or the framed text, or what % else, so that the inserted box is preceded and followed by the % suitable vertical spaces, and it is possible to compute the % number of lines to be indented; often this computed number is correct; @@ -793,7 +795,7 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi % within prohibited wrapping text, such number might need to be % corrected. As it can be seen the optional star is not among % the argument descriptors of the opening commands; it will be -% the following macro \cs{WR@wr} to take care of examining +% the following macro \cs{WR@wr} responsible of taking care of % the list of arguments and see if a star has been specified and % not yet read by the preceding commands. % @@ -855,7 +857,7 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi % After these adjustments, it computes the box total height plus some % fixed amounts needed mostly to set the wrapped material below the % first wrapping text first line. Here is where the \LaTeXiii -% \cs{fpeval} computing macro comes into play so as to assign such +% \cs{fpeval} computing function comes into play so as to assign such % height to \cs{WF@size}. Some unusual macros are executed; they % were devised by Arseneau to deal with possibly floating wrapped % objects. The optional star is not accepted by this macro; if the user @@ -864,11 +866,11 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi % the user specifies it for this environment, an asterisk appears % at the beginning of the wrapped text. % -% The mandatory \texttt{\#4} \meta{width} parameter (actually a -% \meta{optional braced parameter}) may be specified +% The braced \texttt{\#4} \meta{width} parameter (actually a +% \meta{braced optional parameter}) may be specified % to be \texttt{0pt}; in any case \texttt{0pt} is the default parameter % value; if so, the object is treated at its natural width, by -% boxing it into an hbox and using this hbox width as the working width +% boxing it into an hbox and using this box width as the working width % \begin{macrocode} \NewDocumentCommand\WF@wr{o m o m s}{% \xdef\WF@wfname{wrap\@captype\space}% @@ -1030,7 +1032,7 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi \fi \xdef\WF@place{\the\lccode\lccode\WF@place}% }% twice to get only l or r - \hbox to\z@{% llap o rlap depending on lor r; calc effective width + \hbox to\z@{% llap o rlap depending on l or r; calc effective width \@tempdima\wd\WF@box \@tempdimb\WF@ovh \advance\@tempdima-\@tempdimb \advance\@tempdima\columnsep \@tempdimb\hsize \advance\@tempdimb-\@tempdima @@ -1062,7 +1064,6 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi \aftergroup\WF@startwrapping \fi } - % \end{macrocode} % % Here comes the very important macro that counts the wrapping indented @@ -1074,14 +1075,13 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi % fact that this macro cannot preview actions that have not % yet taken place when this macro is executed. % -% This macro is the one that counts the lines to be indented by -% rounding the division of the box height by the current base -% line skip. Notice that \texttt{WF@wrappedlines} is the name -% of a \LaTeX named counter, not of a \TeX numeric register; -% therefore special LaTeX commands, such as \cs{setocounter} or -% \cs{value}, have to be used in order to set or access the -% numerical value stored within the \TeX register associated -% to the \LaTeX counter name. +% This macro counts the lines to be indented by rounding the division +% of the box height by the current base line skip. Notice that +% \texttt{WF@wrappedlines} is the name of a \LaTeX named counter, +% not of a \TeX numeric register; therefore special LaTeX commands, +% such as \cs{setocounter} or \cs{value}, have to be used in order +% to set or access the numerical value stored within the \TeX +% register associated to the \LaTeX counter name. % \begin{macrocode} \def\WF@startwrapping{% \ifnum\WF@wli=\z@ % no number was specified @@ -1309,7 +1309,7 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi % % Here there is some Arseneau's code that renders his \pack{wrapfig} % code compatible with \cs{newfloat} of class \class{memoir}, and -% with \cs{newfoatlist} of package \pack{ccaption}. We leave his code +% with \cs{newfloatlist} of package \pack{ccaption}. We leave his code % hereafter; but we did not test it with this package. % \begin{macrocode} \let\WF@floatstyhook\relax @@ -1370,13 +1370,13 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi % \end{macrocode} % We never described the package options; this code was present -% in Arseneau's code and ve leave it here, with the necessary -% package name change. We think that this \opz{verbose} option +% in Arseneau's code and we leave it here, with the necessary +% package-name changes. We think that this \opz{verbose} option % was and remains useless, since the instances of command % \cs{WF@info} were mostly commented out in the original code; % in any case, input of this code is stopped if the % \cs{DeclareOption} command is not defined; this command was -% defined with \LaTeXe; therefore this is a residual of the old +% defined with \LaTeXe; therefore might be a residual of the old % times when \LaTeXccix was still in use, more than 25 years % ago\dots % \begin{macrocode} diff --git a/macros/latex/contrib/wrapfig2/wrapfig2.pdf b/macros/latex/contrib/wrapfig2/wrapfig2.pdf index 5e60317074..1b17f61e8e 100644 Binary files a/macros/latex/contrib/wrapfig2/wrapfig2.pdf and b/macros/latex/contrib/wrapfig2/wrapfig2.pdf differ diff --git a/macros/latex/contrib/yb-book/DEPENDS.txt b/macros/latex/contrib/yb-book/DEPENDS.txt new file mode 100644 index 0000000000..df34424b3d --- /dev/null +++ b/macros/latex/contrib/yb-book/DEPENDS.txt @@ -0,0 +1,33 @@ +hard xkeyval +hard geometry +hard fontenc +hard inputenc +hard anyfontsize +hard tikz +hard chngcntr +hard lastpage +hard paralist +hard xcolor +hard graphicx +hard setspace +hard textcomp +hard enumitem +hard float +hard ulem +hard qrcode +hard wrapfig +hard xfp +hard soul} % in order to use \st{ +hard xifthen +hard csquotes +hard biblatex +hard imakeidx +hard microtype +hard libertine +hard footmisc +hard titlesec +hard titlesec +hard fancyhdr +hard wrapfig +hard mdframed +hard changepage diff --git a/macros/latex/contrib/yb-book/README.md b/macros/latex/contrib/yb-book/README.md new file mode 100644 index 0000000000..a9eae33589 --- /dev/null +++ b/macros/latex/contrib/yb-book/README.md @@ -0,0 +1,25 @@ +[![make](https://github.com/yegor256/yb-book/actions/workflows/make.yml/badge.svg)](https://github.com/yegor256/yb-book/actions/workflows/make.yml) +[![License](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/yegor256/yb-book/blob/master/LICENSE.txt) + +This LaTeX class I use to format [my books](https://www.yegor256.com/books.html), +which I sell [on Amazon](https://www.amazon.com/Yegor-Bugayenko/e/B01AM1QMDK). + +First, [install it](https://en.wikibooks.org/wiki/LaTeX/Installing_Extra_Packages) +from [CTAN](https://ctan.org/pkg/yb-book) +and then use in the preamble: + +```tex +\documentclass{yb-book} +\renewcommand*\theauthor{Jeff Lebowski} +\renewcommand*\thevolume{1} +\renewcommand*\thetitle{New Book About OOP} +\begin{document} +Hello, world! +\end{document} +``` + +If you want to contribute yourself, make a fork, then create a branch, +then run `make` in the root directory. +It should compile everything without errors. If not, submit an issue and wait. +Otherwise, make your changes and then run `make` again. If the build is +still clean, submit a pull request. diff --git a/macros/latex/contrib/yb-book/samples/sample.tex b/macros/latex/contrib/yb-book/samples/sample.tex new file mode 100644 index 0000000000..b5528d54ca --- /dev/null +++ b/macros/latex/contrib/yb-book/samples/sample.tex @@ -0,0 +1,41 @@ +% (The MIT License) +% +% Copyright (c) 2021 Yegor Bugayenko +% +% Permission is hereby granted, free of charge, to any person obtaining a copy +% of this software and associated documentation files (the 'Software'), to deal +% in the Software without restriction, including without limitation the rights +% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +% copies of the Software, and to permit persons to whom the Software is +% furnished to do so, subject to the following conditions: +% +% The above copyright notice and this permission notice shall be included in all +% copies or substantial portions of the Software. +% +% THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +% SOFTWARE. + +\documentclass{../yb-book} +\renewcommand*\thetitle{\LaTeX{} Class yb-book} +\renewcommand*\theauthor{Yegor Bugayenko} +\begin{document} + +\ybPrintTitlePage + +\newpage + +\chapter{Overview} + +\section{Purpose} + +\index{computer} +This is a very interesting book about computers. + +\ybPrintIndex + +\end{document} \ No newline at end of file diff --git a/macros/latex/contrib/yb-book/yb-book-logo.pdf b/macros/latex/contrib/yb-book/yb-book-logo.pdf new file mode 100644 index 0000000000..5d49cb9daa Binary files /dev/null and b/macros/latex/contrib/yb-book/yb-book-logo.pdf differ diff --git a/macros/latex/contrib/yb-book/yb-book.cls b/macros/latex/contrib/yb-book/yb-book.cls new file mode 100644 index 0000000000..4b99e80514 --- /dev/null +++ b/macros/latex/contrib/yb-book/yb-book.cls @@ -0,0 +1,341 @@ +% (The MIT License) +% +% Copyright (c) 2021-2022 Yegor Bugayenko +% +% Permission is hereby granted, free of charge, to any person obtaining a copy +% of this software and associated documentation files (the 'Software'), to deal +% in the Software without restriction, including without limitation the rights +% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +% copies of the Software, and to permit persons to whom the Software is +% furnished to do so, subject to the following conditions: +% +% The above copyright notice and this permission notice shall be included in all +% copies or substantial portions of the Software. +% +% THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +% SOFTWARE. + +\NeedsTeXFormat{LaTeX2e} +\ProvidesClass{yb-book}[2022/01/03 0.1.0 YB Branded Book Style] + +\RequirePackage{xkeyval} + +\makeatletter +\newif\ifyb@draft +\DeclareOptionX{draft}{\yb@drafttrue} +\newif\ifyb@compact +\DeclareOptionX{compact}{\yb@compacttrue} +\newif\ifyb@manuscript +\DeclareOptionX{manuscript}{\yb@manuscripttrue} +\ProcessOptionsX +\makeatother + +\makeatletter\ifyb@draft + \PassOptionsToClass{11pt}{book} + \PassOptionsToClass{oneside}{book} +\else + \ifyb@manuscript + \PassOptionsToClass{12pt}{book} + \PassOptionsToClass{oneside}{book} + \else + \PassOptionsToClass{11pt}{book} + \PassOptionsToClass{twoside}{book} + \fi +\fi\makeatother + +\LoadClass{book} + +\RequirePackage{geometry} + \geometry{paperwidth=6in, paperheight=9in, bindingoffset=0.25in, left=0.75in, right=0.75in, top=0.75in, bottom=1.25in} + \makeatletter\ifyb@draft + \geometry{a4paper, margin=1in, left=1.5in} + \else + \ifyb@manuscript + \geometry{a4paper, margin=1.2in} + \fi + \fi\makeatother + +\RequirePackage[T1]{fontenc} +\RequirePackage[utf8]{inputenc} +\RequirePackage{anyfontsize} +\RequirePackage{tikz} + \usetikzlibrary{positioning} + \usetikzlibrary{shapes} + \usetikzlibrary{fit} +\RequirePackage{chngcntr} + \counterwithout{footnote}{chapter} +\RequirePackage{lastpage} +\RequirePackage{paralist} +\RequirePackage{xcolor} +\RequirePackage{graphicx} +\RequirePackage{setspace} + \setstretch{1.2} + \makeatletter\ifyb@draft\setstretch{1.1}\fi\makeatother + \makeatletter\ifyb@compact\setstretch{1.0}\fi\makeatother + \makeatletter\ifyb@manuscript\setstretch{1.1}\fi\makeatother +\RequirePackage{textcomp} +\RequirePackage[inline]{enumitem} + \setlist{nosep} +\RequirePackage{float} +\RequirePackage[normalem]{ulem} +\RequirePackage{qrcode} +\RequirePackage{wrapfig} + \pagestyle{plain} +\RequirePackage{xfp} +\RequirePackage{soul} % in order to use \st{} to strikethrough +\RequirePackage{xifthen} +\RequirePackage[autostyle=try]{csquotes} + +\RequirePackage[indexing=cite,style=authoryear,natbib=true,maxnames=1,minnames=1,doi=false,url=false,isbn=false,isbn=false]{biblatex} + \DeclareCiteCommand{\citetitle} + {\boolfalse{citetracker}% + \boolfalse{pagetracker}% + \usebibmacro{prenote}} + {\ifciteindex + {\indexnames{labelname}} + {}% + \printfield[citetitle]{labeltitle}} + {\multicitedelim} + {\usebibmacro{postnote}} + \DeclareCiteCommand*{\citetitle} + {\boolfalse{citetracker}% + \boolfalse{pagetracker}% + \usebibmacro{prenote}} + {\ifciteindex + {\indexnames{labelname}} + {}% + \printfield[citetitle]{title}} + {\multicitedelim} + {\usebibmacro{postnote}} +\RequirePackage{imakeidx} + \renewbibmacro*{citeindex}{\indexnames{labelname}{}} + \makeindex + \indexsetup{othercode={\hyphenpenalty=10000}} + +\newenvironment{condensed}{% + \begingroup\setstretch{1.0}% + % This lsstyle is defined by 'letterspace' in microtype + \lsstyle}{\endgroup} + +\makeatletter\ifyb@draft\else + \RequirePackage[letterspace=-50]{microtype} +\fi\makeatother + +\makeatletter\ifyb@manuscript + \RequirePackage[tt=false,type1=true]{libertine} +\fi\makeatother + +\RequirePackage[bottom,perpage,multiple]{footmisc} + % see https://tex.stackexchange.com/questions/40072/incompatibility-between-footmisc-option-multiple-and-hyperref/62091#62091 + \makeatletter\let\yb@oldfootnote\footnote\makeatother + \makeatletter\newcommand\yb@nexttoken\relax\makeatother + \makeatletter\newcommand\yb@isfootnote{% + \ifx\footnote\yb@nexttoken\textsuperscript{,}\fi}\makeatother + \makeatletter\renewcommand\footnote[1]{% + \yb@oldfootnote{#1}\futurelet\yb@nexttoken\yb@isfootnote}\makeatother + +\makeatletter + \let\yb@oldsection\section + \ifyb@draft + \RequirePackage[medium]{titlesec} + \else + \RequirePackage[raggedright]{titlesec} + \titlespacing{\section}{0in}{6pt}{6pt}[1in] + \renewcommand\section{\newpage\yb@oldsection} + \fi +\makeatother + +\makeatletter\ifyb@compact + \renewcommand\section{\vspace{2em}\yb@oldsection} +\fi\makeatother + +\makeatletter\ifyb@draft + \RequirePackage{fancyhdr} + \pagestyle{fancy} + \renewcommand\headrulewidth{0pt} + \renewcommand\footrulewidth{0pt} + \fancyhf{} + \fancyhead[L,C,LO,CO]{} + \fancyhead[R,RO]{ + \begin{textblock}{4}(11.5,1) + \begin{tikzpicture} + \node [color=gray, rotate=270, font=\ttfamily\scriptsize, text width=5in] at (0,0) { + Copyright \textcopyright{} \the\year{} by \theauthor{}. + All rights reserved. No part of the contents of this book may be + reproduced or transmitted in any form or by any means without the + written permission of the publisher. + This particular manuscript is printed for + \textbf{\thereviewer{}} and may be used only for one-time review. The + manuscript has to be destroyed after the review. + }; + \end{tikzpicture} + \end{textblock} + } + \fancyfoot[C,CO]{\small\ttfamily page \#\thepage{} of \pageref{LastPage}} +\fi\makeatother + +\renewcommand\maketitle{ + {\LARGE\textbf{\thetitle}} + \\[1em] + by \theauthor{} + \\[4em] + \ifx\thevolume\empty\else% + Volume \thevolume{}\\ + \fi + \ifx\thedate\empty\else% + Rendered on \thedate{} + \fi + \ifx\theversion\empty\else% + \\ + Ver. \theversion{} + \fi +} + +\makeatletter\newcommand\ybPrintTitlePage{ + \ifyb@draft\else + \begin{titlepage} + \ttfamily + \vspace*{\fill} + \noindent + {\Huge\textbf{\thetitle}} + \\[1em] + by \theauthor{} + \\[4em] + \ifx\thevolume\empty\else% + Volume \thevolume{}\\ + \fi + \ifx\thedate\empty\else% + \thedate{} + \fi + \ifx\thedate\empty\else% + \\ + \theversion{} + \fi + \vspace*{\fill} + \end{titlepage} + \fi +}\makeatother + +\makeatletter\newcommand\ybPrintTOC{ + \ifyb@draft\else + \ifyb@compact\else\cleardoublepage\fi + {\setstretch{0.7}\tableofcontents} + \fi +}\makeatother + +\makeatletter\newcommand\ybPrintIndex[1][Index]{ + \ifyb@draft\else + \cleardoublepage + { + \setstretch{1.0} + \small + \addcontentsline{toc}{chapter}{#1} + \printindex + } + \fi +}\makeatother + +\newcommand\ybPrintIcons{% + \ifdefempty{\theemail{}}{}{% + \includegraphics[height=1em]{images/icon-email.pdf}% + \theemail{}% + }% + \includegraphics[height=1em]{images/icon-twitter.pdf}% + \includegraphics[height=1em]{images/icon-linkedin.pdf}% + \includegraphics[height=1em]{images/icon-github.pdf}% + \includegraphics[height=1em]{images/icon-instagram.pdf}% + \includegraphics[height=1em]{images/icon-facebook.pdf}% + \thesocial{}% +} + +% quotes +\RequirePackage{wrapfig} +\RequirePackage{mdframed} +\RequirePackage{changepage} + \strictpagecheck +\mdfdefinestyle{quoteodd}{backgroundcolor=black!0, + leftmargin=6pt,rightmargin=0pt, + innerleftmargin=6pt,innerrightmargin=0pt, + innertopmargin=0pt,innerbottommargin=0pt, + skipabove=0pt,skipbelow=0pt, + linewidth=2pt, + topline=false,bottomline=false,rightline=false} +\mdfdefinestyle{quoteeven}{backgroundcolor=black!0, + rightmargin=6pt,leftmargin=0pt, + innerrightmargin=6pt,innerleftmargin=0pt, + innertopmargin=0pt,innerbottommargin=0pt, + skipabove=0pt,skipbelow=0pt, + linewidth=2pt, + topline=false,bottomline=false,leftline=false} +\makeatletter\newcommand\ybQuote[3]{% + \ifthenelse{\isempty{#3}}{}{ + \ifx\hfuzz#2\hfuzz% + \index{#3}% + \else% + \index{#3, #2}% + \fi% + }% + \def\yb@body{% + \raggedright% + \ifx\hfuzz#3\hfuzz% + #1% + \else% + ``#1''\\\raggedleft---#2 #3% + \fi% + } + \ifyb@draft% + \begin{wrapfigure}{r}{0.4\textwidth}% + \begin{mdframed}[style=quoteodd]% + \yb@body% + \end{mdframed}% + \end{wrapfigure}% + \else% + \begin{wrapfigure}{o}[12pt]{0.4\textwidth}% + \sffamily\checkoddpage% + \ifoddpage% + \begin{mdframed}[style=quoteodd]\yb@body\end{mdframed}% + \else% + \begin{mdframed}[style=quoteeven]\yb@body\end{mdframed}% + \fi% + \vspace{-12pt} + \end{wrapfigure}% + \fi% +}\makeatother + +\makeatletter\newcommand\ybPrintBibliography{% + \AtNextBibliography{\small}% + \raggedright% + \ifyb@manuscript% + \setlength\bibitemsep{0pt}% + \newpage% + \begin{multicols}{2}{\setstretch{1.0}\printbibliography}\end{multicols} + \else + \printbibliography + \fi +}\makeatother + +\AtBeginDocument{% + \raggedbottom% + \setlength\topskip{0mm}% + \setlength\parindent{0pt}% + \setlength\parskip{6pt}% + \interfootnotelinepenalty=10000% +} + +\newcommand*\thetitle{\textbackslash{}thetitle} +\newcommand*\thevolume{} +\newcommand*\thedate{} +\newcommand*\theemail{\textbackslash{}theemail} +\newcommand*\thesocial{\textbackslash{}thesocial} +\newcommand*\theversion{\textbackslash{}theversion} +\newcommand*\theauthor{\textbackslash{}theauthor} +\newcommand*\thereviewer{\textbackslash{}thereviewer} +\newcommand*\theyear{\textbackslash{}theyear} +\newcommand*\theprice{\textbackslash{}theprice} + +\endinput diff --git a/macros/latex/contrib/yb-book/yb-book.pdf b/macros/latex/contrib/yb-book/yb-book.pdf new file mode 100644 index 0000000000..cde5f931f5 Binary files /dev/null and b/macros/latex/contrib/yb-book/yb-book.pdf differ diff --git a/macros/latex/contrib/yb-book/yb-book.tex b/macros/latex/contrib/yb-book/yb-book.tex new file mode 100644 index 0000000000..0937552058 --- /dev/null +++ b/macros/latex/contrib/yb-book/yb-book.tex @@ -0,0 +1,79 @@ +% (The MIT License) +% +% Copyright (c) 2021-2022 Yegor Bugayenko +% +% Permission is hereby granted, free of charge, to any person obtaining a copy +% of this software and associated documentation files (the 'Software'), to deal +% in the Software without restriction, including without limitation the rights +% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +% copies of the Software, and to permit persons to whom the Software is +% furnished to do so, subject to the following conditions: +% +% The above copyright notice and this permission notice shall be included in all +% copies or substantial portions of the Software. +% +% THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +% SOFTWARE. + +\documentclass[compact,manuscript]{./yb-book} +\usepackage{ffcode} +\usepackage{href-ul} +\renewcommand*\theversion{0.1.0} +\renewcommand*\thedate{2022/01/03} +\renewcommand*\thetitle{\LaTeX{} Class \ff{yb-book}} +\renewcommand*\theauthor{Yegor Bugayenko} + +\begin{document} + +\includegraphics[height=6em]{yb-book-logo.pdf} +\vspace*{24pt} + +\maketitle + +\index{Amazon} +The provided class \ff{yb-book} helps me design +\href{https://www.yegor256.com/books.html}{my books} and +publish them +\href{https://www.amazon.com/Yegor-Bugayenko/e/B01AM1QMDK}{on Amazon}. + +There are a few class options you can use: + +\ff{compact} --- when you need to make text more compact +and take less vertical space; + +\ff{manuscript} --- when the format is not for Amazon printing, +but for some other purposes (the page size is A4), like the document +you are reading right now; + +\ff{draft} --- when it's a draft for reviewers (the page size is A4) +and you want to have a watermark and a compact form of the content; + +\section*{Printers} + +There are a number of printers, commands that print large blocks of text +in the expected format: + +\ff{\textbackslash{}ybPrintTitlePage} --- prints the first page of a book. + +\ff{\textbackslash{}ybPrintTOC} --- prints the table of contents. + +\ff{\textbackslash{}ybQuote} --- prints a side quote. + +\ff{\textbackslash{}ybPrintBibliography} --- prints the list of bib references. + +\ff{\textbackslash{}ybPrintIcons} --- prints your social icons. + +\ff{\textbackslash{}ybPrintIndex[1]} --- prints index with an optional name of the section (instead of ``Index''). + +For more samples, check the directory \ff{samples/}. + +You are welcome to suggest additional commands, but the style +of my books is intentionally as simple as possible, avoiding formatting +as much as possible. + +\end{document} \ No newline at end of file -- cgit v1.2.3