Skip to content

Commit

Permalink
#1 rename
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Jan 3, 2022
1 parent 54ab154 commit 191511c
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 67 deletions.
2 changes: 1 addition & 1 deletion .gitignore
@@ -1,7 +1,7 @@
.DS_Store
target/
_minted-*
ybook.pdf
yb-book.pdf
*.zip
*.toc
*.bbl
Expand Down
36 changes: 19 additions & 17 deletions Makefile
Expand Up @@ -24,41 +24,43 @@

.ONESHELL:

all: ybook.pdf make-samples zip
all: yb-book.pdf make-samples zip

ybook.pdf: ybook.tex ybook.cls
yb-book.pdf: yb-book.tex yb-book.cls
latexmk -pdf $<
texsc $<
texqc --ignore 'You have requested document class' --ignore 'parboxrestore has changed' $<
texqc --ignore 'You have requested document class' \
--ignore 'csquotes should be loaded after fvextra' \
--ignore 'parboxrestore has changed' $<

zip: ybook.pdf ybook.cls
zip: yb-book.pdf yb-book.cls
rm -rf package
mkdir package
cd package
mkdir ybook
cd ybook
cp -r ../../ybook-signature.pdf .
mkdir yb-book
cd yb-book
cp -r ../../yb-book-logo.pdf .
cp ../../README.md .
version=$$(cat ../../VERSION.txt)
echo "Version is: $${version}"
date=$$(date +%Y/%m/%d)
echo "Date is: $${date}"
cp ../../ybook.cls .
gsed -i "s|0\.0\.0|$${version}|" ybook.cls
gsed -i "s|00\.00\.0000|$${date}|" ybook.cls
cp ../../ybook.tex .
gsed -i "s|0\.0\.0|$${version}|" ybook.tex
gsed -i "s|00\.00\.0000|$${date}|" ybook.tex
cp ../../yb-book.cls .
gsed -i "s|0\.0\.0|$${version}|" yb-book.cls
gsed -i "s|00\.00\.0000|$${date}|" yb-book.cls
cp ../../yb-book.tex .
gsed -i "s|0\.0\.0|$${version}|" yb-book.tex
gsed -i "s|00\.00\.0000|$${date}|" yb-book.tex
cp ../../.latexmkrc .
latexmk -pdf ybook.tex
latexmk -pdf yb-book.tex
rm .latexmkrc
rm -rf _minted-* *.aux *.bbl *.bcf *.blg *.fdb_latexmk *.fls *.log *.run.xml *.out *.ind *.idx *.ilg
mkdir samples
cp ../../samples/*.tex samples
cat ybook.cls | grep RequirePackage | gsed -e "s/.*{\(.\+\)}.*/hard \1/" > DEPENDS.txt
cat yb-book.cls | grep RequirePackage | gsed -e "s/.*{\(.\+\)}.*/hard \1/" > DEPENDS.txt
cd ..
zip -r ybook-$${version}.zip *
cp ybook-$${version}.zip ..
zip -r yb-book-$${version}.zip *
cp yb-book-$${version}.zip ..
cd ..

clean:
Expand Down
8 changes: 4 additions & 4 deletions README.md
@@ -1,15 +1,15 @@
[![make](https://github.com/yegor256/ybook/actions/workflows/make.yml/badge.svg)](https://github.com/yegor256/ybook/actions/workflows/make.yml)
[![License](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/yegor256/ybook/blob/master/LICENSE.txt)
[![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/ybook)
from [CTAN](https://ctan.org/pkg/yb-book)
and then use in the preamble:

```tex
\documentclass{ybook}
\documentclass{yb-book}
\renewcommand*\theauthor{Jeff Lebowski}
\renewcommand*\thevolume{1}
\renewcommand*\thetitle{New Book About OOP}
Expand Down
4 changes: 2 additions & 2 deletions samples/Makefile
Expand Up @@ -24,10 +24,10 @@

.ONESHELL:

all: ybook-sample.pdf
all: sample.pdf

clean:
git clean -dfX

%.pdf: %.tex ../ybook.cls
%.pdf: %.tex ../yb-book.cls
latexmk -pdf $<
4 changes: 2 additions & 2 deletions samples/ybook-sample.tex → samples/sample.tex
Expand Up @@ -20,8 +20,8 @@
% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
% SOFTWARE.

\documentclass{../ybook}
\renewcommand*\thetitle{\LaTeX{} Class ybook}
\documentclass{../yb-book}
\renewcommand*\thetitle{\LaTeX{} Class yb-book}
\renewcommand*\theauthor{Yegor Bugayenko}
\begin{document}

Expand Down
File renamed without changes.
74 changes: 37 additions & 37 deletions ybook.cls → yb-book.cls
Expand Up @@ -21,25 +21,25 @@
% SOFTWARE.

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{ybook}[00.00.0000 0.0.0 YB Branded Book Style]
\ProvidesClass{yb-book}[00.00.0000 0.0.0 YB Branded Book Style]

\RequirePackage{xkeyval}

\makeatletter
\newif\ifybook@draft
\DeclareOptionX{draft}{\ybook@drafttrue}
\newif\ifybook@compact
\DeclareOptionX{compact}{\ybook@compacttrue}
\newif\ifybook@manuscript
\DeclareOptionX{manuscript}{\ybook@manuscripttrue}
\newif\ifyb@draft
\DeclareOptionX{draft}{\yb@drafttrue}
\newif\ifyb@compact
\DeclareOptionX{compact}{\yb@compacttrue}
\newif\ifyb@manuscript
\DeclareOptionX{manuscript}{\yb@manuscripttrue}
\ProcessOptionsX
\makeatother

\makeatletter\ifybook@draft
\makeatletter\ifyb@draft
\PassOptionsToClass{11pt}{book}
\PassOptionsToClass{oneside}{book}
\else
\ifybook@manuscript
\ifyb@manuscript
\PassOptionsToClass{12pt}{book}
\PassOptionsToClass{oneside}{book}
\else
Expand All @@ -52,10 +52,10 @@

\RequirePackage{geometry}
\geometry{paperwidth=6in, paperheight=9in, bindingoffset=0.25in, left=0.75in, right=0.75in, top=0.75in, bottom=1.25in}
\makeatletter\ifybook@draft
\makeatletter\ifyb@draft
\geometry{a4paper, margin=1in, left=1.5in}
\else
\ifybook@manuscript
\ifyb@manuscript
\geometry{a4paper, margin=1.2in}
\fi
\fi\makeatother
Expand All @@ -75,9 +75,9 @@
\RequirePackage{graphicx}
\RequirePackage{setspace}
\setstretch{1.2}
\makeatletter\ifybook@draft\setstretch{1.1}\fi\makeatother
\makeatletter\ifybook@compact\setstretch{1.0}\fi\makeatother
\makeatletter\ifybook@manuscript\setstretch{1.1}\fi\makeatother
\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}
Expand Down Expand Up @@ -122,39 +122,39 @@
% This lsstyle is defined by 'letterspace' in microtype
\lsstyle}{\endgroup}

\makeatletter\ifybook@draft\else
\makeatletter\ifyb@draft\else
\RequirePackage[letterspace=-50]{microtype}
\fi\makeatother

\makeatletter\ifybook@manuscript
\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\ybook@oldfootnote\footnote\makeatother
\makeatletter\newcommand\ybook@nexttoken\relax\makeatother
\makeatletter\newcommand\ybook@isfootnote{%
\ifx\footnote\ybook@nexttoken\textsuperscript{,}\fi}\makeatother
\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]{%
\ybook@oldfootnote{#1}\futurelet\ybook@nexttoken\ybook@isfootnote}\makeatother
\yb@oldfootnote{#1}\futurelet\yb@nexttoken\yb@isfootnote}\makeatother

\makeatletter
\let\ybook@oldsection\section
\ifybook@draft
\let\yb@oldsection\section
\ifyb@draft
\RequirePackage[medium]{titlesec}
\else
\RequirePackage[raggedright]{titlesec}
\titlespacing{\section}{0in}{6pt}{6pt}[1in]
\renewcommand\section{\newpage\ybook@oldsection}
\renewcommand\section{\newpage\yb@oldsection}
\fi
\makeatother

\makeatletter\ifybook@compact
\renewcommand\section{\vspace{2em}\ybook@oldsection}
\makeatletter\ifyb@compact
\renewcommand\section{\vspace{2em}\yb@oldsection}
\fi\makeatother

\makeatletter\ifybook@draft
\makeatletter\ifyb@draft
\RequirePackage{fancyhdr}
\pagestyle{fancy}
\renewcommand\headrulewidth{0pt}
Expand Down Expand Up @@ -197,7 +197,7 @@
}

\makeatletter\newcommand\ybPrintTitlePage{
\ifybook@draft\else
\ifyb@draft\else
\begin{titlepage}
\ttfamily
\vspace*{\fill}
Expand All @@ -222,14 +222,14 @@
}\makeatother

\makeatletter\newcommand\ybPrintTOC{
\ifybook@draft\else
\ifybook@compact\else\cleardoublepage\fi
\ifyb@draft\else
\ifyb@compact\else\cleardoublepage\fi
{\setstretch{0.7}\tableofcontents}
\fi
}\makeatother

\makeatletter\newcommand\ybPrintIndex[1][Index]{
\ifybook@draft\else
\ifyb@draft\else
\cleardoublepage
{
\setstretch{1.0}
Expand Down Expand Up @@ -280,27 +280,27 @@
\index{#3, #2}%
\fi%
}%
\def\ybook@body{%
\def\yb@body{%
\raggedright%
\ifx\hfuzz#3\hfuzz%
#1%
\else%
``#1''\\\raggedleft---#2 #3%
\fi%
}
\ifybook@draft%
\ifyb@draft%
\begin{wrapfigure}{r}{0.4\textwidth}%
\begin{mdframed}[style=quoteodd]%
\ybook@body%
\yb@body%
\end{mdframed}%
\end{wrapfigure}%
\else%
\begin{wrapfigure}{o}[12pt]{0.4\textwidth}%
\sffamily\checkoddpage%
\ifoddpage%
\begin{mdframed}[style=quoteodd]\ybook@body\end{mdframed}%
\begin{mdframed}[style=quoteodd]\yb@body\end{mdframed}%
\else%
\begin{mdframed}[style=quoteeven]\ybook@body\end{mdframed}%
\begin{mdframed}[style=quoteeven]\yb@body\end{mdframed}%
\fi%
\vspace{-12pt}
\end{wrapfigure}%
Expand All @@ -310,7 +310,7 @@
\makeatletter\newcommand\ybPrintBibliography{%
\AtNextBibliography{\small}%
\raggedright%
\ifybook@manuscript%
\ifyb@manuscript%
\setlength\bibitemsep{0pt}%
\newpage%
\begin{multicols}{2}{\setstretch{1.0}\printbibliography}\end{multicols}
Expand Down
8 changes: 4 additions & 4 deletions ybook.tex → yb-book.tex
Expand Up @@ -20,23 +20,23 @@
% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
% SOFTWARE.

\documentclass[compact,manuscript]{./ybook}
\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{ybook}}
\renewcommand*\thetitle{\LaTeX{} Class \ff{yb-book}}
\renewcommand*\theauthor{Yegor Bugayenko}

\begin{document}

\includegraphics[height=6em]{ybook-signature.pdf}
\includegraphics[height=6em]{yb-book-logo.pdf}
\vspace*{24pt}

\maketitle

\index{Amazon}
The provided class \ff{ybook} helps me design
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}.
Expand Down

0 comments on commit 191511c

Please sign in to comment.