diff --git a/.github/workflows/l3build.yml b/.github/workflows/l3build.yml new file mode 100644 index 0000000..a5435f5 --- /dev/null +++ b/.github/workflows/l3build.yml @@ -0,0 +1,16 @@ +name: l3build +on: + push: + branches: master + pull_request: + branches: master +jobs: + l3build: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v3 + - uses: teatimeguest/setup-texlive-action@v2.4.1 + with: + package-file: DEPENDS.txt + packages: scheme-basic xetex xkeyval libertine minted fvextra catchfile xstring framed tcolorbox environ anyfontsize chngcntr lastpage paralist enumitem qrcode wrapfig soul xifthen ifmtarg csquotes biblatex imakeidx footmisc titlesec mdframed zref needspace changepage ffcode href-ul + - run: l3build check -q --show-log-on-error diff --git a/.github/workflows/make.yml b/.github/workflows/make.yml deleted file mode 100644 index ff6561c..0000000 --- a/.github/workflows/make.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: make -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: yegor256/latexmk-action@0.3.0 - with: - opts: -pdf - packages: xkeyval libertine minted fvextra catchfile xstring framed tcolorbox environ anyfontsize chngcntr lastpage paralist enumitem qrcode wrapfig soul xifthen ifmtarg csquotes biblatex imakeidx footmisc titlesec mdframed zref needspace changepage ffcode href-ul diff --git a/.gitignore b/.gitignore index 91c1203..a0456bb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,10 @@ .DS_Store target/ +build/ _minted-* yb-book.pdf +*.cls +*.tex *.zip *.toc *.bbl diff --git a/.latexmkrc b/.latexmkrc deleted file mode 100644 index e0d7813..0000000 --- a/.latexmkrc +++ /dev/null @@ -1,2 +0,0 @@ -$pdflatex = 'pdflatex %O --shell-escape %S'; -$latex = 'latex %O --shell-escape %S'; diff --git a/README.md b/README.md index fa9cebb..fcc2528 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ -[![make](https://github.com/yegor256/yb-book/actions/workflows/make.yml/badge.svg)](https://github.com/yegor256/yb-book/actions/workflows/make.yml) +[![make](https://github.com/yegor256/yb-book/actions/workflows/l3build.yml/badge.svg)](https://github.com/yegor256/yb-book/actions/workflows/l3build.yml) +[![CTAN](https://img.shields.io/ctan/v/yb-book)](https://ctan.org/pkg/yb-book) [![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), diff --git a/build.lua b/build.lua new file mode 100644 index 0000000..545d3c1 --- /dev/null +++ b/build.lua @@ -0,0 +1,33 @@ +module = "yb-book" +ctanupload = true +typesetopts = "--interaction=batchmode --shell-escape" +checkopts = "--interaction=batchmode --shell-escape" +tagfiles = {"build.lua", "yb-book.dtx"} +docfiles = {"yb-book-logo.pdf"} + +uploadconfig = { + pkg = "yb-book", + version = "0.0.0", + author = "Yegor Bugayenko", + uploader = "Yegor Bugayenko", + email = "yegor256@gmail.com", + note = "Bug fixes", + announcement = "", + ctanPath = "/macros/latex/contrib/yb-book", + bugtracker = "https://github.com/yegor256/yb-book/issues", + home = "", + description = "This template helps the author design books published on Amazon under the “Y.B.” brand. You are welcome to use it too for your own books.", + development = "", + license = "mit", + summary = "Template for YB Branded Books", + repository = "https://github.com/yegor256/yb-book", + support = "", + topic = {"class", "document-template", "book-publication"} +} + +function update_tag(file, content, tagname, tagdate) + return string.gsub( + string.gsub(content, "0%.0%.0", tagname), + "00%.00%.0000", os.date("%d.%m.%Y") + ) +end diff --git a/samples/.gitignore b/samples/.gitignore deleted file mode 100644 index f08278d..0000000 --- a/samples/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.pdf \ No newline at end of file diff --git a/samples/.latexmkrc b/samples/.latexmkrc deleted file mode 100644 index e0d7813..0000000 --- a/samples/.latexmkrc +++ /dev/null @@ -1,2 +0,0 @@ -$pdflatex = 'pdflatex %O --shell-escape %S'; -$latex = 'latex %O --shell-escape %S'; diff --git a/samples/Makefile b/samples/Makefile deleted file mode 100644 index b4e914f..0000000 --- a/samples/Makefile +++ /dev/null @@ -1,33 +0,0 @@ -# (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. - -.SHELLFLAGS = -e -x -c - -.ONESHELL: - -all: sample.pdf - -clean: - git clean -dfX - -%.pdf: %.tex ../yb-book.cls - latexmk -pdf $< diff --git a/samples/sample.tex b/samples/sample.tex deleted file mode 100644 index be2f84d..0000000 --- a/samples/sample.tex +++ /dev/null @@ -1,41 +0,0 @@ -% (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{../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/tests/.gitignore b/testfiles/.gitignore similarity index 100% rename from tests/.gitignore rename to testfiles/.gitignore diff --git a/testfiles/simple.luatex.tlg b/testfiles/simple.luatex.tlg new file mode 100644 index 0000000..599d8e2 --- /dev/null +++ b/testfiles/simple.luatex.tlg @@ -0,0 +1,105 @@ +This is a generated file for the l3build validation system. +Don't change this file in any respect. +[1 +] [2 +] +LaTeX Font Info: Trying to load font information for T1+lmtt on input line .... +Package microtype Info: Loading generic protrusion settings for font family +(microtype) `lmtt' (encoding: T1). +(microtype) For optimal results, create family-specific settings. +(microtype) See the microtype manual for details. +LaTeX Font Info: Font shape `T1/lmtt/bx/n' in size <24.88> not available +(Font) Font shape `T1/lmtt/b/n' tried instead on input line .... +[1] [2 +] +Chapter 1. +[3] +LaTeX Font Info: Trying to load font information for T1+lmss on input line .... +Package microtype Info: Loading generic protrusion settings for font family +(microtype) `lmss' (encoding: T1). +(microtype) For optimal results, create family-specific settings. +(microtype) See the microtype manual for details. +Package mdframed Info: mdframed works in twoside mode on input line .... +Package mdframed Info: mdframed inside float + mdframed uses option nobreak mdframed on input line .... +Package mdframed Info: mdframed inside a box + mdframed uses option nobreak mdframed on input line .... +LaTeX Warning: Reference `mdf@pagelabel-1' on page 4 undefined on input line .... +Underfull \hbox (badness 10000) in paragraph at lines 14--16 +\T1/lmr/m/n/10.95 This is a very in-ter-est-ing book about com-put-ers. +\hbox(7.54317+2.12914)x307.1475, glue set 5.60138, direction TLT +.\kern-0.3942 (left margin) +.\localpar +..\localinterlinepenalty=0 +..\localbrokenpenalty=0 +..\localleftbox=null +..\localrightbox=null +.\T1/lmr/m/n/10.95 T +.\T1/lmr/m/n/10.95 h +.\T1/lmr/m/n/10.95 i +.\T1/lmr/m/n/10.95 s +.\glue(\spaceskip) 3.65 plus 1.825 minus 1.21666 +.\T1/lmr/m/n/10.95 i +.\T1/lmr/m/n/10.95 s +.\glue(\spaceskip) 3.65 plus 1.825 minus 1.21666 +.\T1/lmr/m/n/10.95 a +.\glue(\spaceskip) 3.65 plus 1.825 minus 1.21666 +.\T1/lmr/m/n/10.95 v +.\kern-0.30418 (font) +.\T1/lmr/m/n/10.95 e +.\T1/lmr/m/n/10.95 r +.\T1/lmr/m/n/10.95 y +.\glue(\spaceskip) 3.65 plus 1.825 minus 1.21666 +.\T1/lmr/m/n/10.95 i +.\T1/lmr/m/n/10.95 n +.\discretionary (penalty 50) +..< \T1/lmr/m/n/10.95 - +..= \kern-0.30418 (font) +.\T1/lmr/m/n/10.95 t +.\T1/lmr/m/n/10.95 e +.\T1/lmr/m/n/10.95 r +.\discretionary (penalty 50) +..< \T1/lmr/m/n/10.95 - +.\T1/lmr/m/n/10.95 e +.\T1/lmr/m/n/10.95 s +.\T1/lmr/m/n/10.95 t +.\discretionary (penalty 50) +..< \T1/lmr/m/n/10.95 - +.\T1/lmr/m/n/10.95 i +.\T1/lmr/m/n/10.95 n +.\T1/lmr/m/n/10.95 g +.\glue(\spaceskip) 3.65 plus 1.825 minus 1.21666 +.\T1/lmr/m/n/10.95 b +.\kern0.30417 (font) +.\T1/lmr/m/n/10.95 o +.\kern0.30417 (font) +.\T1/lmr/m/n/10.95 o +.\T1/lmr/m/n/10.95 k +.\glue(\spaceskip) 3.65 plus 1.825 minus 1.21666 +.\T1/lmr/m/n/10.95 a +.\T1/lmr/m/n/10.95 b +.\kern0.30417 (font) +.\T1/lmr/m/n/10.95 o +.\T1/lmr/m/n/10.95 u +.\T1/lmr/m/n/10.95 t +.\glue(\spaceskip) 3.65 plus 1.825 minus 1.21666 +.\T1/lmr/m/n/10.95 c +.\T1/lmr/m/n/10.95 o +.\T1/lmr/m/n/10.95 m +.\discretionary (penalty 50) +..< \T1/lmr/m/n/10.95 - +.\T1/lmr/m/n/10.95 p +.\T1/lmr/m/n/10.95 u +.\T1/lmr/m/n/10.95 t +.\discretionary (penalty 50) +..< \T1/lmr/m/n/10.95 - +.\T1/lmr/m/n/10.95 e +.\T1/lmr/m/n/10.95 r +.\T1/lmr/m/n/10.95 s +.\T1/lmr/m/n/10.95 . +.\penalty 10000 +.\kern-2.1243 (right margin) +.\glue(\parfillskip) 0.0 +.\glue(\rightskip) 0.0 +[4] (simple.ind) +LaTeX Warning: Empty bibliography on input line .... diff --git a/testfiles/simple.lvt b/testfiles/simple.lvt new file mode 100644 index 0000000..acfe44f --- /dev/null +++ b/testfiles/simple.lvt @@ -0,0 +1,20 @@ +\input{regression-test.tex} +\documentclass{yb-book} +\begin{document} +\START + +\renewcommand*\thetitle{Simple} +\renewcommand*\theauthor{Yegor Bugayenko} +Hello, world! +\ybPrintTitlePage +\newpage +\chapter{Overview} +\section{Purpose} +\index{computer} +This is a very interesting book about computers. +\ybQuote{Never tell the truth to people who + are not worthy of it}{Mark Twain}{} +\ybPrintIndex +\ybPrintBibliography + +\END \ No newline at end of file diff --git a/testfiles/simple.tlg b/testfiles/simple.tlg new file mode 100644 index 0000000..d14a03a --- /dev/null +++ b/testfiles/simple.tlg @@ -0,0 +1,103 @@ +This is a generated file for the l3build validation system. +Don't change this file in any respect. +[1 +] [2 +] +LaTeX Font Info: Trying to load font information for T1+cmtt on input line .... +Package microtype Info: Loading generic protrusion settings for font family +(microtype) `cmtt' (encoding: T1). +(microtype) For optimal results, create family-specific settings. +(microtype) See the microtype manual for details. +LaTeX Font Info: Font shape `T1/cmtt/bx/n' in size <24.88> not available +(Font) Font shape `T1/cmtt/m/n' tried instead on input line .... +[1] [2 +] +Chapter 1. +[3] +LaTeX Font Info: Trying to load font information for T1+cmss on input line .... +Package microtype Info: Loading generic protrusion settings for font family +(microtype) `cmss' (encoding: T1). +(microtype) For optimal results, create family-specific settings. +(microtype) See the microtype manual for details. +Package mdframed Info: mdframed works in twoside mode on input line .... +Package mdframed Info: mdframed inside float + mdframed uses option nobreak mdframed on input line .... +Package mdframed Info: mdframed inside a box + mdframed uses option nobreak mdframed on input line .... +LaTeX Warning: Reference `mdf@pagelabel-1' on page 4 undefined on input line .... +Underfull \hbox (badness 10000) in paragraph at lines 14--16 +\T1/cmr/m/n/10.95 (+20) This is a very in-ter-est-ing book about com-put-ers. +\hbox(7.54149+2.12863)x307.1475, glue set 5.75014 +.\kern-0.39197 (left margin) +.\T1/cmr/m/n/10.95 (+20) T +.\T1/cmr/m/n/10.95 (+20) h +.\T1/cmr/m/n/10.95 (+20) i +.\T1/cmr/m/n/10.95 (+20) s +.\glue 3.63054 plus 1.81337 minus 1.20892 +.\T1/cmr/m/n/10.95 (+20) i +.\T1/cmr/m/n/10.95 (+20) s +.\glue 3.63054 plus 1.81337 minus 1.20892 +.\T1/cmr/m/n/10.95 (+20) a +.\glue 3.63054 plus 1.81337 minus 1.20892 +.\T1/cmr/m/n/10.95 (+20) v +.\kern-0.30225 +.\T1/cmr/m/n/10.95 (+20) e +.\T1/cmr/m/n/10.95 (+20) r +.\T1/cmr/m/n/10.95 (+20) y +.\glue 3.63054 plus 1.81337 minus 1.20892 +.\T1/cmr/m/n/10.95 (+20) i +.\discretionary replacing 2 +..\T1/cmr/m/n/10.95 (+20) n +..\T1/cmr/m/n/10.95 (+20) - +.\T1/cmr/m/n/10.95 (+20) n +.\kern-0.30225 +.\T1/cmr/m/n/10.95 (+20) t +.\T1/cmr/m/n/10.95 (+20) e +.\T1/cmr/m/n/10.95 (+20) r +.\discretionary +..\T1/cmr/m/n/10.95 (+20) - +.\T1/cmr/m/n/10.95 (+20) e +.\T1/cmr/m/n/10.95 (+20) s +.\T1/cmr/m/n/10.95 (+20) t +.\discretionary +..\T1/cmr/m/n/10.95 (+20) - +.\T1/cmr/m/n/10.95 (+20) i +.\T1/cmr/m/n/10.95 (+20) n +.\T1/cmr/m/n/10.95 (+20) g +.\glue 3.63054 plus 1.81337 minus 1.20892 +.\T1/cmr/m/n/10.95 (+20) b +.\kern0.30223 +.\T1/cmr/m/n/10.95 (+20) o +.\kern0.30223 +.\T1/cmr/m/n/10.95 (+20) o +.\T1/cmr/m/n/10.95 (+20) k +.\glue 3.63054 plus 1.81337 minus 1.20892 +.\T1/cmr/m/n/10.95 (+20) a +.\T1/cmr/m/n/10.95 (+20) b +.\kern0.30223 +.\T1/cmr/m/n/10.95 (+20) o +.\T1/cmr/m/n/10.95 (+20) u +.\T1/cmr/m/n/10.95 (+20) t +.\glue 3.63054 plus 1.81337 minus 1.20892 +.\T1/cmr/m/n/10.95 (+20) c +.\T1/cmr/m/n/10.95 (+20) o +.\T1/cmr/m/n/10.95 (+20) m +.\discretionary +..\T1/cmr/m/n/10.95 (+20) - +.\T1/cmr/m/n/10.95 (+20) p +.\T1/cmr/m/n/10.95 (+20) u +.\T1/cmr/m/n/10.95 (+20) t +.\discretionary +..\T1/cmr/m/n/10.95 (+20) - +.\T1/cmr/m/n/10.95 (+20) e +.\T1/cmr/m/n/10.95 (+20) r +.\T1/cmr/m/n/10.95 (+20) s +.\T1/cmr/m/n/10.95 (+20) . +.\penalty 10000 +.\kern-2.12314 (right margin) +.\glue(\parfillskip) 0.0 +.\glue(\rightskip) 0.0 +[4] +runsystem(makeindex simple.idx)...executed. +(simple.ind) +LaTeX Warning: Empty bibliography on input line .... diff --git a/testfiles/simple.xetex.tlg b/testfiles/simple.xetex.tlg new file mode 100644 index 0000000..832653d --- /dev/null +++ b/testfiles/simple.xetex.tlg @@ -0,0 +1,103 @@ +This is a generated file for the l3build validation system. +Don't change this file in any respect. +[1 +] [2 +] +LaTeX Font Info: Trying to load font information for T1+lmtt on input line .... +Package microtype Info: Loading generic protrusion settings for font family +(microtype) `lmtt' (encoding: T1). +(microtype) For optimal results, create family-specific settings. +(microtype) See the microtype manual for details. +LaTeX Font Info: Font shape `T1/lmtt/bx/n' in size <24.88> not available +(Font) Font shape `T1/lmtt/b/n' tried instead on input line .... +[1] [2 +] +Chapter 1. +[3] +LaTeX Font Info: Trying to load font information for T1+lmss on input line .... +Package microtype Info: Loading generic protrusion settings for font family +(microtype) `lmss' (encoding: T1). +(microtype) For optimal results, create family-specific settings. +(microtype) See the microtype manual for details. +Package mdframed Info: mdframed works in twoside mode on input line .... +Package mdframed Info: mdframed inside float + mdframed uses option nobreak mdframed on input line .... +Package mdframed Info: mdframed inside a box + mdframed uses option nobreak mdframed on input line .... +LaTeX Warning: Reference `mdf@pagelabel-1' on page 4 undefined on input line .... +Underfull \hbox (badness 10000) in paragraph at lines 14--16 +\T1/lmr/m/n/10.95 This is a very in-ter-est-ing book about com-put-ers. +\hbox(7.54317+2.12914)x307.1475, glue set 5.9281 +.\kern-0.3942 (left margin) +.\T1/lmr/m/n/10.95 T +.\T1/lmr/m/n/10.95 h +.\T1/lmr/m/n/10.95 i +.\T1/lmr/m/n/10.95 s +.\glue 3.65 plus 1.825 minus 1.21666 +.\T1/lmr/m/n/10.95 i +.\T1/lmr/m/n/10.95 s +.\glue 3.65 plus 1.825 minus 1.21666 +.\T1/lmr/m/n/10.95 a +.\glue 3.65 plus 1.825 minus 1.21666 +.\T1/lmr/m/n/10.95 v +.\kern-0.30418 +.\T1/lmr/m/n/10.95 e +.\T1/lmr/m/n/10.95 r +.\T1/lmr/m/n/10.95 y +.\glue 3.65 plus 1.825 minus 1.21666 +.\T1/lmr/m/n/10.95 i +.\discretionary replacing 2 +..\T1/lmr/m/n/10.95 n +..\T1/lmr/m/n/10.95 - +.\T1/lmr/m/n/10.95 n +.\kern-0.30418 +.\T1/lmr/m/n/10.95 t +.\T1/lmr/m/n/10.95 e +.\T1/lmr/m/n/10.95 r +.\discretionary +..\T1/lmr/m/n/10.95 - +.\T1/lmr/m/n/10.95 e +.\T1/lmr/m/n/10.95 s +.\T1/lmr/m/n/10.95 t +.\discretionary +..\T1/lmr/m/n/10.95 - +.\T1/lmr/m/n/10.95 i +.\T1/lmr/m/n/10.95 n +.\T1/lmr/m/n/10.95 g +.\glue 3.65 plus 1.825 minus 1.21666 +.\T1/lmr/m/n/10.95 b +.\kern0.30417 +.\T1/lmr/m/n/10.95 o +.\kern0.30417 +.\T1/lmr/m/n/10.95 o +.\T1/lmr/m/n/10.95 k +.\glue 3.65 plus 1.825 minus 1.21666 +.\T1/lmr/m/n/10.95 a +.\T1/lmr/m/n/10.95 b +.\kern0.30417 +.\T1/lmr/m/n/10.95 o +.\T1/lmr/m/n/10.95 u +.\T1/lmr/m/n/10.95 t +.\glue 3.65 plus 1.825 minus 1.21666 +.\T1/lmr/m/n/10.95 c +.\T1/lmr/m/n/10.95 o +.\T1/lmr/m/n/10.95 m +.\discretionary +..\T1/lmr/m/n/10.95 - +.\T1/lmr/m/n/10.95 p +.\T1/lmr/m/n/10.95 u +.\T1/lmr/m/n/10.95 t +.\discretionary +..\T1/lmr/m/n/10.95 - +.\T1/lmr/m/n/10.95 e +.\T1/lmr/m/n/10.95 r +.\T1/lmr/m/n/10.95 s +.\T1/lmr/m/n/10.95 . +.\penalty 10000 +.\kern-2.1243 (right margin) +.\glue(\parfillskip) 0.0 +.\glue(\rightskip) 0.0 +[4] +runsystem(makeindex simple.idx)...executed. +(simple.ind) +LaTeX Warning: Empty bibliography on input line .... diff --git a/tests/.latexmkrc b/tests/.latexmkrc deleted file mode 100644 index e0d7813..0000000 --- a/tests/.latexmkrc +++ /dev/null @@ -1,2 +0,0 @@ -$pdflatex = 'pdflatex %O --shell-escape %S'; -$latex = 'latex %O --shell-escape %S'; diff --git a/tests/Makefile b/tests/Makefile deleted file mode 100644 index 1a56c5f..0000000 --- a/tests/Makefile +++ /dev/null @@ -1,33 +0,0 @@ -# (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. - -TEXS=$(wildcard *.tex) -PDFS=$(TEXS:.tex=.pdf) - -all: $(PDFS) - -%.pdf: %.tex - latexmk -pdf "$<" - -clean: - git clean -dfX - diff --git a/tests/simple.tex b/tests/simple.tex deleted file mode 100644 index c659d05..0000000 --- a/tests/simple.tex +++ /dev/null @@ -1,25 +0,0 @@ -% (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{../yb-book} -\begin{document} -Hello, world! -\end{document} \ No newline at end of file diff --git a/yb-book.dtx b/yb-book.dtx new file mode 100644 index 0000000..6953556 --- /dev/null +++ b/yb-book.dtx @@ -0,0 +1,615 @@ +% \iffalse meta-comment +% (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. +% \fi + +%%% \CheckSum{0} +% +% \CharacterTable +% {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 +% 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 +% Digits \0\1\2\3\4\5\6\7\8\9 +% Exclamation \! Double quote \" Hash (number) \# +% Dollar \$ Percent \% Ampersand \& +% Acute accent \' Left paren \( Right paren \) +% Asterisk \* Plus \+ Comma \, +% Minus \- Point \. Solidus \/ +% Colon \: Semicolon \; Less than \< +% Equals \= Greater than \> Question mark \? +% Commercial at \@ Left bracket \[ Backslash \\ +% Right bracket \] Circumflex \^ Underscore \_ +% Grave accent \` Left brace \{ Vertical bar \| +% Right brace \} Tilde \~} + +% \GetFileInfo{yb-book.dtx} +% \DoNotIndex{\end,\empty,\defined,\def,\begin,\if,\isempty,\endgroup,\begingroup,\let,\else,\fi,\newcommand,\newenvironment} + +% \iffalse +%<*driver> +\ProvidesFile{yb-book.dtx} +% +%\NeedsTeXFormat{LaTeX2e} +%\ProvidesClass{yb-book} +%<*class> +[00.00.0000 0.0.0 YB Branded Book Style] +% +%<*driver> +\documentclass{ltxdoc} +\usepackage[tt=false, type1=true]{libertine} +\usepackage{href-ul} +\usepackage{graphicx} +\PageIndex +\EnableCrossrefs +\CodelineIndex +\RecordChanges +\begin{document} + \DocInput{yb-book.dtx} + \PrintChanges + \PrintIndex +\end{document} +% +% \fi + +% \title{\includegraphics[width=0.75in]{yb-book-logo.pdf} \\ \LaTeX{} Class |yb-book|\thanks{The sources are in GitHub at \href{https://github.com/yegor256/yb-book.cls}{yegor256/yb-book.cls}}} +% \author{Yegor Bugayenko \\ \texttt{yegor256@gmail.com}} +% \date{\filedate, \fileversion} +% +% \maketitle +% +% \section{Introduction} +% +% \index{Amazon} +% The provided class |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}. +% You are welcome to use is for your own books. It is as simple +% as this: +%\iffalse +%<*verb> +%\fi +\begin{verbatim} +\documentclass{yb-book} +\renewcommand*\thetitle{New Book About OOP} +\renewcommand*\theauthor{Jeff Lebowski} +\renewcommand*\thevolume{1} +\renewcommand*\theversion{1.0} +\begin{document} +\ybPrintTitlePage +\chapter{First One} +\section{About Something Interesting} +Hello, world! +\end{document} +\end{verbatim} +%\iffalse +% +%\fi + +% You are welcome to suggest additional options and commands, but the style +% of my books is intentionally as simple as possible, avoiding formatting +% as much as possible. Here is \href{https://www.yegor256.com/2019/05/21/dont-improvise.html}{why}. + +% \section{Options} + +% There are a few class options you can use: + +% \begin{macro}{compact} +% Use this package option when you need to make text more compact +% and take less vertical space. This may be convenient fiction books. +% I use this option to render \href{https://www.yegor256.com/code-ahead.html}{Code Ahead} book. +% \end{macro} + +% \begin{macro}{manuscript} +% When the format is not for Amazon printing, +% but for some other purposes (the page size is A4), this option may be +% convenient. I also use it when I want the book to be rendered for +% printing on paper for review purposes. +% \end{macro} + +% \begin{macro}{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. This +% option goes together with |\thereviewer{}| command, which you may redefine, +% in order to embed the name of the reviewed in the watermark. This may +% help you prevent theft of your book: +%\iffalse +%<*verb> +%\fi +\begin{verbatim} +\documentclass[draft]{yb-book} +\renewcommand*\thereviewer{Walter Sobchak} +\begin{document} +Hello, world! +\end{document} +\end{verbatim} +%\iffalse +% +%\fi +% \end{macro} + +% \section{Printers} + +% There are a number of printers --- commands that print large blocks of text +% in the expected format: + +% \begin{macro}{\ybPrintTitlePage} +% Prints the first page of a book. It expects at least |\thetitle| +% and |theauthor| to be defined: +%\iffalse +%<*verb> +%\fi +\begin{verbatim} +\documentclass{yb-book} +\renewcommand*\thetitle{My New Book} +\renewcommand*\theauthor{Yegor Bugayenko} +\begin{document} +\ybPrintTitlePage +.. the rest of the book goes here +\end{document} +\end{verbatim} +%\iffalse +% +%\fi +% \end{macro} + +% \begin{macro}{\ybPrintTOC} +% Prints the table of contents. +% \end{macro} + +% \begin{macro}{\ybQuote} +% Prints a side quote: +%\iffalse +%<*verb> +%\fi +\begin{verbatim} +\documentclass{yb-book} +\begin{document} +Hello, world! +\ybQuote{Never tell the truth to people who + are not worthy of it}{Mark Twain}{} +\end{document} +\end{verbatim} +%\iffalse +% +%\fi +% \end{macro} + +% \begin{macro}{\ybPrintBibliography} +% Prints the list of bib references. +% \end{macro} + +% \begin{macro}{\ybPrintIndex} +% Prints index with an optional name of the section (instead of ``Index''): +%\iffalse +%<*verb> +%\fi +\begin{verbatim} +\documentclass{yb-book} +\begin{document} +Hello, world! +\ybPrintIndex{Recommended Books} +\end{document} +\end{verbatim} +%\iffalse +% +%\fi +% \end{macro} + +% \StopEventually{} + +% \section{Implementation} + +% \changes{v0.2.0}{2021/07/10}{Initial version} + +% First, we use |xkeyval| package for package options parsing: +% \begin{macrocode} +\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 +% \end{macrocode} + +% Then, depending on the options like |draft| and |manuscript|, we preset +% options of the class |book| and then load it: +% \begin{macrocode} +\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} +% \end{macrocode} + +% Then, using |geometry|, we setup page layout: +% \begin{macrocode} +\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 +% \end{macrocode} + +% Then, we load many important packages: +% \begin{macrocode} +\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{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} +% \end{macrocode} + +% Then, using |setspace| package we set the spacing between lines in the text: +% \begin{macrocode} +\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 +% \end{macrocode} + +% Then, we configure |biblatex|, for citation management: +% \begin{macrocode} +\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}} +% \end{macrocode} + +% \begin{macro}{condensed} +% Then, we define |condensed| environment for snippets +% (|lsstyle| is defined by |letterspace| in |microtype|): +% \begin{macrocode} +\newenvironment{condensed} + {\begingroup\setstretch{1.0}\lsstyle} + {\endgroup} +% \end{macrocode} +% \end{macro} + +% Then, we include |microtype| for better rendering: +% \begin{macrocode} +\makeatletter\ifyb@draft\else + \RequirePackage[letterspace=-50]{microtype} +\fi\makeatother +% \end{macrocode} + +% Then, we include |libertine|, for a good looking font: +% \begin{macrocode} +\makeatletter\ifyb@manuscript + \RequirePackage[tt=false,type1=true]{libertine} +\fi\makeatother +% \end{macrocode} + +% Then, we use and configure |footmisc| as suggested +% \href{https://tex.stackexchange.com/questions/40072/incompatibility-between-footmisc-option-multiple-and-hyperref/62091#62091}{here}: +% \begin{macrocode} +\RequirePackage[bottom,perpage,multiple]{footmisc} +\makeatletter + \let\yb@oldfootnote\footnote +\newcommand\yb@nexttoken\relax +\newcommand\yb@isfootnote{% + \ifx\footnote\yb@nexttoken\textsuperscript{,}\fi} +\renewcommand\footnote[1]{% + \yb@oldfootnote{#1}\futurelet\yb@nexttoken\yb@isfootnote} +\makeatother +% \end{macrocode} + +% \begin{macro}{\section} +% Then, we redefine |\section| command: +% \begin{macrocode} +\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 +\ifyb@compact + \renewcommand\section{\vspace{2em}\yb@oldsection} +\fi +\makeatother +% \end{macrocode} +% \end{macro} + +% Then, if it's a |draft|, we put a watermark comment: +% \begin{macrocode} +\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{\if\defined\thereviewer\thereviewer\else + designated reviewer\fi} 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 +% \end{macrocode} + +% \begin{macro}{\maketitle} +% Then, we redefine |\maketitle| command: +% \begin{macrocode} +\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 +} +% \end{macrocode} +% \end{macro} + +% \begin{macro}{\ybPrintTitlePage} +% Then, we define |\ybPrintTitlePage| command: +% \begin{macrocode} +\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 +% \end{macrocode} +% \end{macro} + +% \begin{macro}{\ybPrintTOC} +% Then, we define |ybPrintTOC| command to print table of contents: +% \begin{macrocode} +\makeatletter\newcommand\ybPrintTOC{ + \ifyb@draft\else + \ifyb@compact\else\cleardoublepage\fi + {\setstretch{0.7}\tableofcontents} + \fi +}\makeatother +% \end{macrocode} +% \end{macro} + +% \begin{macro}{\ybPrintIndex} +% Then, we configure |imakeidx| package and define |\ybPrintIndex| command: +% \begin{macrocode} +\RequirePackage{imakeidx} + \renewbibmacro*{citeindex}{\indexnames{labelname}{}} + \makeindex + \indexsetup{othercode={\hyphenpenalty=10000}} +\makeatletter\newcommand\ybPrintIndex[1][Index]{ + \ifyb@draft\else + \cleardoublepage + { + \setstretch{1.0} + \small + \addcontentsline{toc}{chapter}{#1} + \printindex + } + \fi +}\makeatother +% \end{macrocode} +% \end{macro} + +% \begin{macro}{\ybQuote} +% Then, with the hep of |wrapfig| and |mdframed|, we define |\ybQuote| command: +% \begin{macrocode} +\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 +% \end{macrocode} +% \end{macro} + +% \begin{macro}{\ybPrintBibliography} +% Then, we define |\ybPrintBibliography|, to print a list of references: +% \begin{macrocode} +\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 +% \end{macrocode} +% \end{macro} + +% Then, a few layout configurations at the beginning of the document: +% \begin{macrocode} +\AtBeginDocument{% + \raggedbottom% + \setlength\topskip{0mm}% + \setlength\parindent{0pt}% + \setlength\fboxsep{0pt}% + \setlength\parskip{6pt}% + \interfootnotelinepenalty=10000% +} +% \end{macrocode} + +% Then, a few meta commands with default values: +% \begin{macrocode} +\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} +% \end{macrocode} + +% \Finale + +%\clearpage +% +%\PrintChanges +%\clearpage +%\PrintIndex diff --git a/yb-book.ins b/yb-book.ins new file mode 100644 index 0000000..a84a03f --- /dev/null +++ b/yb-book.ins @@ -0,0 +1,55 @@ +%% (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. + +\input docstrip.tex +\keepsilent +\usedir{macros/latex/contrib/yb-book} +\preamble +(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. +\endpreamble +\generate{\file{yb-book.cls}{\from{yb-book.dtx}{class}}} +\obeyspaces +\Msg{*** To finish the installation you have to move the ".cls"} +\Msg{*** file into a directory searched by TeX. To produce the} +\Msg{*** documentation run the file ".dtx" through LaTeX. If any} +\Msg{*** questions, submit a new GitHub issue.} +\endbatchfile diff --git a/yb-book.tex b/yb-book.tex deleted file mode 100644 index fadd860..0000000 --- a/yb-book.tex +++ /dev/null @@ -1,77 +0,0 @@ -% (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.0.0} -\renewcommand*\thedate{00.00.0000} -\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{}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