summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/nostarch
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2023-05-11 03:03:22 +0000
committerNorbert Preining <norbert@preining.info>2023-05-11 03:03:22 +0000
commit9e4111819083b4794937d896ecb306c32daa1c2e (patch)
tree5c9de1de0d1ad9bbf7fcfd1acaac3f004e91e060 /macros/latex/contrib/nostarch
parent5e139880c66c4b758877d1724c95670a40f8c2dc (diff)
CTAN sync 202305110303
Diffstat (limited to 'macros/latex/contrib/nostarch')
-rw-r--r--macros/latex/contrib/nostarch/README8
-rw-r--r--macros/latex/contrib/nostarch/nostarch.bib34
-rw-r--r--macros/latex/contrib/nostarch/nostarch.dtx308
-rw-r--r--macros/latex/contrib/nostarch/nostarch.pdfbin290838 -> 350878 bytes
-rw-r--r--macros/latex/contrib/nostarch/nssample.pdfbin279615 -> 281557 bytes
-rw-r--r--macros/latex/contrib/nostarch/nssample.tex108
-rw-r--r--macros/latex/contrib/nostarch/tabletest.pdfbin0 -> 35332 bytes
-rw-r--r--macros/latex/contrib/nostarch/tabletest.tex215
-rw-r--r--macros/latex/contrib/nostarch/urltest.pdfbin0 -> 18227 bytes
-rw-r--r--macros/latex/contrib/nostarch/urltest.tex8
10 files changed, 621 insertions, 60 deletions
diff --git a/macros/latex/contrib/nostarch/README b/macros/latex/contrib/nostarch/README
index ca989a73ab..96dc00c597 100644
--- a/macros/latex/contrib/nostarch/README
+++ b/macros/latex/contrib/nostarch/README
@@ -10,6 +10,14 @@ nshyper.sty and MakeIndex style nostarch.ist.
CHANGES:
+Version 2.1
+ Urls now correspond to the requirements of NoStarch: italic font,
+ low tilde, splitting according to the NoStarch rules
+ Bibliography updates
+ New formatting for captions.
+ Longtable is now loaded by default
+ New code for colored rows
+
Version 2.0:
Incorporated the changes by Alex Freed and other members of
the NoStarch team over the years.
diff --git a/macros/latex/contrib/nostarch/nostarch.bib b/macros/latex/contrib/nostarch/nostarch.bib
index f9f13d7d4f..009b80c0d9 100644
--- a/macros/latex/contrib/nostarch/nostarch.bib
+++ b/macros/latex/contrib/nostarch/nostarch.bib
@@ -13,7 +13,7 @@
author = {Boris Veytsman},
month = {February},
note =
- {\url{http://ctan.tug.org/tex-archive/fonts/psfonts/adobe/nbaskerv}},
+ {\url{https:/ctan.org/pkg/nbaskerv}},
title = {{\LaTeX} Support For New Baskerville Fonts From
Adobe},
year = {2008},
@@ -23,7 +23,7 @@
author = {Boris Veytsman},
month = {February},
note =
- {\url{http://ctan.tug.org/tex-archive/fonts/psfonts/adobe/futurans}},
+ {\url{https://ctan.org/pkg/futurans}},
title = {{\LaTeX} Support For Futura Fonts From Adobe As Used
By No Starch Press},
year = {2008},
@@ -33,7 +33,7 @@
author = {Boris Veytsman},
month = {February},
note =
- {\url{http://ctan.tug.org/tex-archive/fonts/psfonts/emigre/dogma}},
+ {\url{https://ctan.org/pkg/dogma}},
title = {{\LaTeX} Support For Dogma Fonts From Emigre
Graphics},
year = {2008},
@@ -43,7 +43,7 @@
author = {Boris Veytsman},
month = {February},
note =
- {\url{http://ctan.tug.org/tex-archive/fonts/psfonts/fontfabrik/thsmc}},
+ {\url{https://ctan.org/pkg/thsmc}},
title = {{\LaTeX} Support For The Sans Mono Condensed Fonts},
year = {2008},
}
@@ -52,7 +52,7 @@
author = {Heiko Oberdiek},
month = {February},
note =
- {\url{http://ctan.tug.org/tex-archive/macros/latex/contrib/oberdiek}},
+ {\url{https://ctan.org/pkg/oberdiek}},
title = {The \textsf{ifpdf} Package},
year = {2006},
}
@@ -61,7 +61,7 @@
author = {van Oostrum, Piet},
month = {March},
note =
- {\url{http://ctan.tug.org/tex-archive/macros/latex/contrib/fancyhdr}},
+ {\url{https://ctan.org/pkg/fancyhdr}},
title = {Page Layout in \LaTeX},
year = {2004},
}
@@ -70,7 +70,7 @@
author = {Simon Fear},
month = {April},
note =
- {\url{http://ctan.tug.org/tex-archive/macros/latex/contrib/booktabs}},
+ {\url{https://ctan.org/pkg/booktabs}},
title = {Publication Quality Tables in {\LaTeX}},
year = {2005},
}
@@ -79,7 +79,7 @@
author = {D. P. Carlisle},
month = {November},
note =
- {\url{http://ctan.tug.org/tex-archive/macros/latex/required/graphics}},
+ {\url{https://ctan.org/pkg/graphics}},
title = {Packages in the `Graphics' Bundle},
year = {2005},
}
@@ -88,7 +88,7 @@
author = {Axel Sommerfeldt},
month = {February},
note =
- {\url{http://ctan.tug.org/tex-archive/macros/latex/contrib/caption}},
+ {\url{https://ctan.org/pkg/caption}},
title = {Typesetting Captions with the \textsf{caption}
Package},
year = {2007},
@@ -99,7 +99,7 @@
editor = {Denis Girou},
month = {July},
note =
- {\url{http://ctan.tug.org/tex-archive/macros/latex/contrib/fancyvrb}},
+ {\url{https://ctan.org/pkg/fancyvrb}},
title = {The \textsf{`fancyvrb'} Package. Fancy Verbatims in
{\LaTeX}},
year = {1998},
@@ -109,7 +109,7 @@
author = {Martin Schr\"oder},
month = {March},
note =
- {\url{http://ctan.tug.org/tex-archive/macros/latex/contrib/ms}},
+ {\url{https://ctan.org/pkg/ms}},
title = {The \textsf{ragged2e} Package},
year = {2003},
}
@@ -118,7 +118,7 @@
author = {Sebastian Rahtz and Heiko Oberdiek},
month = {September},
note =
- {\url{http://ctan.tug.org/tex-archive/macros/latex/contrib/hyperref}},
+ {\url{https://ctan.org/pkg/hyperref}},
title = {Hypertext Marks in \LaTeX: a Manual for Hyperref},
year = {2006},
}
@@ -137,7 +137,7 @@
author = {Patrick W. Daly},
month = {February},
note =
- {\url{http://ctan.tug.org/tex-archive/macros/latex/contrib/natbib}},
+ {\url{https://ctan.org/pkg/natbib}},
title = {Natural Sciences Citations and References
(Author-Year and Numerical Schemes)},
year = {2007},
@@ -147,7 +147,7 @@
author = {Peter Wilson},
month = {January},
note =
- {\url{http://ctan.tug.org/tex-archive/macros/latex/contrib/memoir}},
+ {\url{https://ctan.org/pkg/memoir}},
title = {The Memoir Class for Configurable Typesetting},
year = {2004},
}
@@ -156,7 +156,7 @@
author = {Leslie Lamport and Frank Mittelbach and
Johannes Braams},
note =
- {\url{http://ctan.tug.org/tex-archive/macros/latex/base}},
+ {\url{https://ctan.org/pkg/base}},
title = {Standard Document Classes for {\LaTeX{}} version 2e},
year = {1997},
}
@@ -164,7 +164,7 @@
@manual{Heinz07:Listings,
author = {Carsten Heinz and Brooks Moses},
note =
- {\url{http://ctan.tug.org/tex-archive/macros/latex/contrib/listings}},
+ {\url{https://ctan.org/pkg/listings}},
title = {The \textsf{Listings} Package},
year = {2007},
}
@@ -173,7 +173,7 @@
@manual{Covington03:Upquote,
author = {Michale A. Covington and Frank Mittelback},
note =
- {\url{http://ctan.tug.org/tex-archive/macros/latex/contrib/upquote}},
+ {\url{https://ctan.org/pkg/upquote}},
title = {Covington's Upright-Quote Modification to Verbatim and
Verb},
year = {2003},
diff --git a/macros/latex/contrib/nostarch/nostarch.dtx b/macros/latex/contrib/nostarch/nostarch.dtx
index d39fb87722..56969391d5 100644
--- a/macros/latex/contrib/nostarch/nostarch.dtx
+++ b/macros/latex/contrib/nostarch/nostarch.dtx
@@ -474,16 +474,21 @@
% captions. The captions for figures go \emph{below} the figures, the
% captions for tables go \emph{above} the tabular data.
%
-% If a caption for a table or figure turns out to be wider than the
-% body, you might want to split the caption into lines. Remember,
-% however, that the mandatory argument to |\caption| becomes
-% ``robust'' in the \LaTeX{} parlance~\cite{Lamport94} only when there
-% is the optional one. Therefore the correct way to split a caption
-% is the following:
+% \DescribeMacro{\NextCaptionWidth}%
+% The captions of tables and figures are automatically typeset with
+% the same width as the table or figure. Sometimes, however, \LaTeX\
+% makes a mistake in the calculation. In this case the macro
+% \cs{NextCaptionWidth}\marg{length} overrides this calculation and
+% sets the width of the caption for the next figure or table to
+% \marg{length}, for example
% \begin{verbatim}
-% \caption[A Long Caption With Lines To Split]{%
-% A Long Caption\\ With Lines To Split}
+% \NextCaptionWidth{2in}
+% \begin{figure}
+% ...
+% \caption{...}
+% \end{figure}
% \end{verbatim}
+%
%
% Typesetting tables, unfortunately, is rarely done right, and
% standard \LaTeX{} is not an exception. The authors are urged to
@@ -583,6 +588,18 @@
% example, in quote characters.
%
%
+%\subsection{Boxes}
+%\label{sec:ug_boxes}
+%
+% \DescribeEnv{nspbox}%
+% You may put some information into \emph{boxes}. Boxes have a \emph{heading}
+% and a \emph{text}. The environment |nspbox| can be used to typeset
+% them, for example:
+% \begin{verbatim}
+% \begin{nspbox}{This is a heading}
+% This is a text for the box.
+% \end{nspbox}
+% \end{verbatim}
%
%\subsection{Back Matter}
%\label{sec:guide:backmatter}
@@ -686,7 +703,7 @@
%<class>\ProvidesClass{nostarch}
%<nshyper>\ProvidesPackage{nshyper}
%<*!ist>
-[2023/03/30 v2.0 Typesetting books for No Starch Press]
+[2023/04/08 v2.1 Typesetting books for No Starch Press]
%</!ist>
% \end{macrocode}
%
@@ -783,10 +800,11 @@ pagecolor=black,urlcolor=black,hyperindex=false]{hyperref}
% A bunch of packages:
% \begin{macrocode}
\RequirePackage[table]{xcolor}
-\RequirePackage{iftex, ifpdf, fancyhdr, fancyvrb, booktabs, graphicx,
+\RequirePackage{iftex, ifpdf, longtable,
+ fancyhdr, fancyvrb, booktabs, graphicx,
listings, caption, makeidx, upquote, pifont,
textcomp, xcolor, lmodern, nameref, float, amssymb, etoolbox,
- setspace, marginnote}
+ setspace, marginnote, url}
\RequirePackage[framemethod=TikZ]{mdframed}
\RequirePackage{soul}
\RequirePackage[T1]{fontenc}
@@ -2377,17 +2395,189 @@ pagecolor=black,urlcolor=black,hyperindex=false]{hyperref}
% \end{macrocode}
% \end{macro}
%
+% Setting up longtables
+% \begin{macrocode}
+\def\LTleft{\z@}
+\def\LTright{\fill}
+% \end{macrocode}
+%
+% \begin{macro}{\ifnostarch@overridecaptionwidth}
+% \changes{v2.1}{2023/04/09}{Introduced macro}
+% Whether the user wants to override automatically selected caption
+% width
+% \begin{macrocode}
+\newif\ifnostarch@overridecaptionwidth
+\nostarch@overridecaptionwidthfalse
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\nostarch@captionwidth}
+% \changes{v2.1}{2023/04/09}{Introduced macro}
+% The width of the caption. Either set by the user or measured
+% \begin{macrocode}
+\newlength\nostarch@captionwidth
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\NextCaptionWidth}
+% \changes{v2.1}{2023/04/09}{Introduced macro}
+% A user-level command to set the caption width
+% \begin{macrocode}
+\newcommand\NextCaptionWidth[1]{%
+ \global\nostarch@overridecaptionwidthtrue
+ \global\setlength{\nostarch@captionwidth}{#1}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\nostarch@measurecaptionwidth}
+% \changes{v2.1}{2023/04/09}{Introduced macro}
+% We set \cs{nostarch@captionwidth} to the width of the last box
+% unless the flag \cs{ifnostarch@overridecaptionwidth} is set. At the
+% end we set the flag to false.
+% \begin{macrocode}
+\newcommand\nostarch@measurecaptionwidth{%
+ \ifnostarch@overridecaptionwidth\else
+ \par
+ \setbox\@tempboxa\lastbox
+ \setbox\@tempboxa=\hbox{\unhbox\@tempboxa}%
+ \global\setlength{\nostarch@captionwidth}{\wd\@tempboxa}%
+ \box\@tempboxa\par
+ \fi
+ \global\nostarch@overridecaptionwidthfalse
+}
+% \end{macrocode}
+% \end{macro}
+%
+% We measure the width at the begin of the figure caption. Note that
+% the cs{AtBeginCaption} hook is too late for us.
+% \begin{macrocode}
+\AtBeginDocument{%
+\pretocmd{\caption}{\def\@tempa{figure}%
+ \ifx\@tempa\@captype\relax
+ \nostarch@measurecaptionwidth
+ \fi}{}{}}
+% \end{macrocode}
+%
+%
+% We declare the caption format for figures and tables
+% \begin{macrocode}
+\DeclareCaptionFormat*{nostarchfigtblformat}{%
+ \parbox{\nostarch@captionwidth}{#1#2#3}}
+% \end{macrocode}
+%
+% Tables are more complex, because captions are \emph{before} the
+% tables. Therefore we need to write the width into aux file and read
+% it from there. Most of the ideas here are stolen from
+% \textsl{longtable} code.
+%
+% \begin{macro}{\nostarch@tbl@warn}
+% \changes{v2.1}{2023/04/10}{Introduced macro}
+% Whether to ask the user for rerun due to changed widths
+% \begin{macrocode}
+\def\nostarch@tbl@warn{}
+\AtEndDocument{\nostarch@tbl@warn}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\c@nostarch@tbl}
+% \changes{v2.1}{2023/04/10}{Introduced macro}
+% We write the table width into the macro \cs{nostarch@tbl@N}, where
+% $N$ is the roman representation of the table number
+% \begin{macrocode}
+\newcounter{nostarch@tbl}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\nostarch@read@tbl@width}
+% \changes{v2.1}{2023/04/10}{Introduced macro}
+% At the beginning of table environment we read the latest value of the
+% width for the given table and set the caption size
+% \begin{macrocode}
+\newcommand\nostarch@read@tbl@width{%
+ \stepcounter{nostarch@tbl}%
+ \expandafter\ifx\csname nostarch@tbl@\romannumeral\c@nostarch@tbl\endcsname\relax
+ \edef\@tempa{\the\textwidth}%
+ \else
+ \edef\@tempa{\csname nostarch@tbl@\romannumeral\c@nostarch@tbl\endcsname}%
+ \fi
+ \expandafter\setlength\expandafter\nostarch@captionwidth\expandafter{\@tempa}%
+}
+\AtBeginEnvironment{table}{\nostarch@read@tbl@width}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\nostarch@save@tbl@width}
+% \changes{v2.1}{2023/04/10}{Introduced macro}
+% At the end of the table environment we measure the width of the last
+% box and write it in the aux file.
+% \begin{macrocode}
+\newcommand\nostarch@save@tbl@width{%
+ \nostarch@measurecaptionwidth
+ \if@filesw
+ \immediate\write\@auxout{%
+ \gdef\expandafter\noexpand\csname nostarch@tbl@\romannumeral\c@nostarch@tbl\endcsname
+ {\the\nostarch@captionwidth}}%
+ \fi
+ \expandafter\ifx\csname nostarch@tbl@\romannumeral\c@nostarch@tbl\endcsname\relax
+ \edef\@tempa{\the\textwidth}%
+ \else
+ \edef\@tempa{\csname nostarch@tbl@\romannumeral\c@nostarch@tbl\endcsname}%
+ \fi
+ \expandafter\ifdim\@tempa=\nostarch@captionwidth\else
+ \gdef\nostarch@tbl@warn{\ClassWarningNoLine{nostarch}
+ {Table widths have changed. Rerun LaTeX.}}
+ \fi
+}
+\pretocmd{\endtable}{\nostarch@save@tbl@width}{}{}
+% \end{macrocode}
+% \end{macro}
+%
+% The |H| specifier from the |float| package redefines the end of the
+% float, so we need to patch it too
+% \begin{macrocode}
+\pretocmd{\float@endH}{\def\@tempa{table}%
+ \ifx\@tempa\@captype\nostarch@save@tbl@width\fi}{}{}
+% \end{macrocode}
+%
+% \begin{macro}{\nostarch@read@LT@width}
+% \changes{v2.1}{2023/04/10}{Introduced macro}
+% The long table version of setting caption width is different,
+% because a longtable knows its width.
+% \begin{macrocode}
+\def\nostarch@read@LT@width{%
+ \ifnostarch@overridecaptionwidth\else
+ \global\setlength{\nostarch@captionwidth}{\z@}%
+ \bgroup
+ \def\LT@entry##1##2{%
+ \global\addtolength{\nostarch@captionwidth}{##2}}%
+ \csname LT@\romannumeral\c@LT@tables\endcsname
+ \egroup
+ \fi
+ \global\nostarch@overridecaptionwidthfalse
+}
+\AtBeginDocument{\pretocmd{\caption@LT@config}{\global\rownum=1\relax
+ \nostarch@read@LT@width}{}{}}
+\AtBeginEnvironment{longtable}{\global\rownum=0\relax}
+% \end{macrocode}
+% \end{macro}
+%
%
% Fonts for captions
% \begin{macrocode}
-\DeclareCaptionFont{nostarchfigfont}{\sffamily \itshape \fontsize{8.5pt}{9pt}\selectfont}
-\DeclareCaptionFont{nostarchtabfont}{\futurabook \fontsize{9pt}{9pt}\selectfont}
+\DeclareCaptionFont{nostarchfigfont}{\sffamily
+ \itshape \fontsize{8.5pt}{9pt}\selectfont}
+\DeclareCaptionFont{nostarchtabfont}{\futurabook
+ \fontsize{9pt}{9pt}\selectfont}
+% \end{macrocode}
+% And the setup
+% \begin{macrocode}
\captionsetup[figure]{font=nostarchfigfont,singlelinecheck=off,
- aboveskip=8pt,belowskip=-8pt}
+ aboveskip=8pt,belowskip=-8pt, format=nostarchfigtblformat}
\captionsetup[lstlisting]{font=nostarchfigfont,singlelinecheck=off,
aboveskip=4pt, belowskip=0pt}
\captionsetup[table]{font=nostarchtabfont,singlelinecheck=off,
- aboveskip=0pt,belowskip=4pt, labelfont=bf}
+ aboveskip=0pt,belowskip=4pt, labelfont=bf, format=nostarchfigtblformat}
% \end{macrocode}
%
% \begin{macro}{\captionlst}
@@ -2417,6 +2607,7 @@ pagecolor=black,urlcolor=black,hyperindex=false]{hyperref}
% \end{macro}
% \begin{macrocode}
\AtBeginEnvironment{tabular}{\tbfont}
+\AtBeginEnvironment{longtable}{\tbfont}
% \end{macrocode}
%
% \begin{macro}{\heawyrulewidth}
@@ -2509,7 +2700,19 @@ pagecolor=black,urlcolor=black,hyperindex=false]{hyperref}
% \end{macrocode}
% \end{macro}
%
-%\subsection{Verbatim and Listings Customization}
+% Setting up colors in tables
+% \begin{macrocode}
+\rowcolors[]{1}{}{nspgray}
+% \end{macrocode}
+%
+% We extend the height of the rows and delete the space arounr rules
+% \begin{macrocode}
+\setlength{\aboverulesep}{0pt}
+\setlength{\belowrulesep}{0pt}
+\setlength{\extrarowheight}{.8ex}
+% \end{macrocode}
+%
+%\subsection{Verbatim, url and Listings Customization}
%\label{sec:verbatim}
%
% \begin{macro}{Code}
@@ -2556,6 +2759,7 @@ pagecolor=black,urlcolor=black,hyperindex=false]{hyperref}
innerrightmargin=18pt,
innerleftmargin=18pt,
backgroundcolor=nspgray,
+ everyline=true
}
\mdfdefinestyle{custombox}{%
@@ -2566,6 +2770,7 @@ pagecolor=black,urlcolor=black,hyperindex=false]{hyperref}
innerbottommargin=\baselineskip,
innerrightmargin=18pt,
innerleftmargin=18pt,
+ everyline=true
}
\newenvironment{nspbox}[1]
{\begin{mdframed}[style=nspbox]
@@ -2640,6 +2845,74 @@ pagecolor=black,urlcolor=black,hyperindex=false]{hyperref}
}
% \end{macrocode}
%
+% Urls are typeset in italics, with upper tilde, and according to the
+% following rules: URLs should break \emph{before} periods,
+% underscores, equal signs, ampersands, and hyphens but \emph{after}
+% colons, slashes and hash marks. Also, we do not allow splitting
+% before slashes.
+% \begin{macro}{\UrlFont}
+% \changes{v2.1}{2023/04/08}{Redefined macro}
+% Urls are in italic
+% \begin{macrocode}
+\def\UrlFont{\itshape}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\UrlTildeSpecial}
+% \changes{v2.1}{2023/04/08}{Redefined macro}
+% \begin{macrocode}
+\def\UrlTildeSpecial{\do\~{\raise.2ex\hbox{\m@th$\scriptstyle\sim$}}}
+\let\Url@force@Tilde\UrlTildeSpecial
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\UrlBreaks}
+% \changes{v2.1}{2023/04/08}{Redefined macro}
+% \changes{v2.1}{2023/04/10}{Moved slashes to specials}
+% Breaks after colons, slashes, hash marks. Colons are defined in
+% \cs{UrlBigBreaks}, so we need the other signs. We also add some
+% other signs here
+% \begin{macrocode}
+\def\UrlBreaks{\do\#\do\\\do\>\do\]\do\)\do\}}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\UrlSpecials}
+% \changes{v2.1}{2023/04/08}{Redefined macro}
+% \changes{v2.1}{2023/04/11}{Added slashes and double quote}
+% We add to macro special treatment of the chars with breaking URLs.
+% Slashes are interesting: we allow breaking after them, but not
+% before, even after other slashes or colons
+% \emph{before} them
+% \begin{macrocode}
+\g@addto@macro{\UrlSpecials}{%
+ \do\.{\penalty\UrlBreakPenalty\mathchar46\relax}%
+ \do\_{\penalty\UrlBreakPenalty\mathchar95\relax}%
+ \do\={\penalty\UrlBreakPenalty\mathchar61\relax}%
+ \do\&{\penalty\UrlBreakPenalty\mathchar38\relax}%
+ \do\-{\penalty\UrlBreakPenalty\mathchar45\relax}%
+ \do\!{\penalty\UrlBreakPenalty\mathchar33\relax}%
+ \do\?{\penalty\UrlBreakPenalty\mathchar63\relax}%
+ \do\|{\penalty\UrlBreakPenalty\mathchar124\relax}%
+ \do\,{\penalty\UrlBreakPenalty\mathchar44\relax}%
+ \do\;{\penalty\UrlBreakPenalty\mathchar59\relax}%
+ \do\@{\penalty\UrlBreakPenalty\mathchar64\relax}%
+ \do\'{\penalty\UrlBreakPenalty\mathchar39\relax}%
+ \do\"{\penalty\UrlBreakPenalty\mathchar34\relax}%
+ \do\+{\penalty\UrlBreakPenalty\mathchar43\relax}%
+ \do\<{\penalty\UrlBreakPenalty\mathchar60\relax}%
+ \do\[{\penalty\UrlBreakPenalty\mathchar91\relax}%
+ \do\({\penalty\UrlBreakPenalty\mathchar40\relax}%
+ \do\{{\penalty\UrlBreakPenalty\mathchar123\relax}%
+ \do\/{\unpenalty\penalty\@M\mathchar47\penalty\UrlBreakPenalty}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\UrlNoBreaks}
+% \changes{v2.1}{2023/04/08}{Redefined macro}
+% We allow breaks in urls after brackets
+% \begin{macrocode}
+\def\UrlNoBreaks{}
+% \end{macrocode}
+% \end{macro}
%
%\subsection{Margin notes}
%\label{sec:margins}
@@ -2960,8 +3233,7 @@ pagecolor=black,urlcolor=black,hyperindex=false]{hyperref}
% \begin{macrocode}
%<*nshyper>
\RequirePackage[breaklinks,colorlinks,linkcolor=black,
- citecolor=black,pagecolor=black,urlcolor=black,hyperindex,
- bookmarks=false]{hyperref}
+ citecolor=black,pagecolor=black,urlcolor=black,hyperindex]{hyperref}
% \end{macrocode}
%
% \progname{hyperref} expects the starred parts and chapters to have
diff --git a/macros/latex/contrib/nostarch/nostarch.pdf b/macros/latex/contrib/nostarch/nostarch.pdf
index b5c2467124..d0b15ee893 100644
--- a/macros/latex/contrib/nostarch/nostarch.pdf
+++ b/macros/latex/contrib/nostarch/nostarch.pdf
Binary files differ
diff --git a/macros/latex/contrib/nostarch/nssample.pdf b/macros/latex/contrib/nostarch/nssample.pdf
index 80f59d139d..a6b476eba4 100644
--- a/macros/latex/contrib/nostarch/nssample.pdf
+++ b/macros/latex/contrib/nostarch/nssample.pdf
Binary files differ
diff --git a/macros/latex/contrib/nostarch/nssample.tex b/macros/latex/contrib/nostarch/nssample.tex
index ff4cadaeb9..5fbd1c5f8e 100644
--- a/macros/latex/contrib/nostarch/nssample.tex
+++ b/macros/latex/contrib/nostarch/nssample.tex
@@ -11,11 +11,11 @@
\frontmatter
-\author{A.~U.~Thor, C.~O.~R.~Respondent and W.~R.~Iter}
+\author{Boris Veytsman}
-\title{Pellentesque habitant morbi}
+\title{\emph{No Starch Press} example file}
-\subtitle{Cum sociis natoque penatibus}
+\subtitle{A short demonstration}
\nostarchlogo{vitruvian.jpg}
@@ -25,9 +25,8 @@
\begin{copyrightpage}
- \textbf{\sffamily\MakeUppercase{Pellentesque habitant morbi.}}
- Copyright \textcopyright{} 2008 by A.~U.~Thor, C.~O.~R.~Respondent
- and W.~R.~Iter
+ \textbf{\sffamily\MakeUppercase{\emph{No Start Press} example file}}
+ Copyright \textcopyright{} 2023 by Boris Veytsman
No rights reserved. Any part of this work may be reproduced or
transmitted in any form or by any means, electronic or mechanical,
@@ -116,7 +115,14 @@ Or was I a worm---too low crawling for death?\\
\chapter*[Foreword by R.~E.~Viewer]{Foreword}
-\lipsum[48-60]
+This is a foreword. Note that the chapter\index{chapter} has two
+arguments: the title of the chapter and the title for the table of
+contents\index{table of contents!adding to}. The first paragraph
+is automatically typeset in a larger font.
+
+Now a couple of paragraphs of filler text to make some pages.
+
+\lipsum[1-3]
\bigskip
@@ -128,22 +134,32 @@ December 2007
\end{raggedright}
\mainmatter
-\part{Mi aliquam dictum}
+\part{The first part}
+
+The main part of the book starts with the command, well,
+\path{\mainmatter}\index{main matter}.
+
+Again some filler.
\lipsum[77-78]
-\chapter[Morbi ac orci]{Morbi ac orci et nisl hendrerit
- mollis}
+\chapter[The first chapter]{The first chapter (the long title)}
\chapterartfile{1eurogr}\index{euro, coin!Greece}\index{Greek euro|see{euro}}
-
-Fusce adipiscing justo nec ante. Nullam in enim. Pellentesque felis
-orci, sagittis ac, malesuada et, facilisis in, ligula\index{ligula}.
-Nunc\index{nunc} non magna sit amet mi aliquam dictum\index{dictum}.
+The first chapter again has two versions of the title. There is a
+special command \path{\chapterartfile}. It adds the art vignette to
+the start of the chapter. Now again some filler---but here we show
+how to add index entries to the text. Fusce adipiscing justo nec
+ante. Nullam in enim. Pellentesque felis orci, sagittis ac, malesuada
+et, facilisis in, ligula\index{ligula}. Nunc\index{nunc} non magna
+sit amet mi aliquam dictum\index{dictum}.
\section{Quisque aliquam ipsum sed turpis}
+Some additional filler\ldots
+
+
\lipsum[1]
Nam dui ligula\index{ligula}, \emph{fringilla a}, euismod sodales,
@@ -167,6 +183,8 @@ Pellentesque cursus luctus mauris\footnote{\lipsum[3]}.
\section{Nunc\index{nunc} non magna sit amet mi aliquam dictum}
+The index can be even in the section head.
+
\lipsum[32-33]
\subsection{Nam sed augue}
@@ -177,15 +195,17 @@ Pellentesque cursus luctus mauris\footnote{\lipsum[3]}.
\lipsum[36-38]
-\chapter{Proin vel urna}
+\chapter{Footnotes, figures and tables}
\label{chap:proin}
\chapterartfile{100euroit}\index{euro, coin!Italy}\index{Italian
euro|see{euro}}
-Aenean imperdiet\footnote{Quisque aliquam ipsum sed turpis\index{turpis}}.
-Vestibulum ante ipsum pri\-m\-is in faucibus orci luctus et ultrices
-posuere cubilia Curae; Donec lacinia nonummy lectus. Proin vel urna.
-Fusce sit amet orci ac magna iaculis pharetra.
+
+Some examples of footnotes. Aenean imperdiet\footnote{Quisque aliquam
+ ipsum sed turpis\index{turpis}}. Vestibulum ante ipsum pri\-m\-is
+in faucibus orci luctus et ultrices posuere cubilia Curae; Donec
+lacinia nonummy lectus. Proin vel urna. Fusce sit amet orci ac magna
+iaculis pharetra.
Fusce adipiscing justo nec ante. Nullam in enim. Pellentesque felis
orci, sagittis ac, malesuada et, facilisis in, ligula\index{ligula}.
@@ -228,13 +248,15 @@ sit amet augue tristique gravida.\index{ante}
odio.
\end{itemize}
+
\begin{figure}[tp]
\includegraphics[width=3in]{vitruvian}
\index{Da Vinci, Leonardo@\emph{Da Vinci, Leonardo}}
\index{Leonardo Da Vinci@\emph{Leonardo Da Vinci}|see{Da Vinci,
Leonardo}}
\index{Vitruvian Man}
- \caption{Pellentesque laoreet velit nec justo}
+ \caption{Vitruvian man. Note that the caption is typeset in a box
+ with the width automatically calculated from the image.}
\label{fig:one}
\end{figure}
@@ -333,11 +355,10 @@ nunc\index{nunc}, venenatis elementum tortor lorem eu erat.
\begin{table}[tp]
\caption[Sed blandit, tortor a auctor]{Sed blandit, tortor a auctor
- imperdiet, wisi nibh\\ ornare leo,
+ imperdiet, wisi nibh ornare leo,
ac dictum nibh enim eu orci}
- \tbfont
- \begin{tabular}{@{}lll}
- \toprule\let\normalfont=\bfseries%
+ \begin{tabular}{lll}
+ \toprule
\thfont Phasellus & \thfont At Dui & \thfont Donec Commodo \\
\midrule
Augue At Nunc & Nunc In sapien & Et magna mollis \\
@@ -365,9 +386,46 @@ condimentum. Nullam imperdiet mattis neque. Proin eget magna porta
erat rhoncus consectetuer. Aenean pulvinar erat vitae\index{vita} mi.
\index{donec|)}
+
\section{Proin eget magna porta erat rhoncus consectetuer}
-\lipsum[123-124]
+\lipsum[123-125]
+
+\begin{longtable}{lll}
+ \caption{This is a longtable with a very long caption. It will be
+ typeset in several lines}\label{tab:longtable}\\
+ \toprule
+ \thfont First column & \thfont Second column\\
+ \midrule
+ \endfirsthead
+ \caption[]{This is a longtable with a very long caption. It will be
+ typeset in several lines---continued\ldots}\\
+ \toprule
+ \thfont First column & \thfont Second column\\
+ \midrule
+ \endhead
+ \bottomrule
+ \endfoot
+ a & b\\
+ ab & bc\\
+ $\alpha$ & $\beta$\\
+ a & b\\
+ ab & bc\\
+ $\alpha$ & $\beta$\\
+ a & b\\
+ ab & bc\\
+ $\alpha$ & $\beta$\\
+ a & b\\
+ ab & bc\\
+ $\alpha$ & $\beta$\\
+ a & b\\
+ ab & bc\\
+ $\alpha$ & $\beta$\\
+ a & b\\
+ ab & bc\\
+ $\alpha$ & $\beta$\\
+\end{longtable}
+
\part{Curabitur vitae}\index{vita|(}
\label{part:Curabitur}
diff --git a/macros/latex/contrib/nostarch/tabletest.pdf b/macros/latex/contrib/nostarch/tabletest.pdf
new file mode 100644
index 0000000000..5ed27d9915
--- /dev/null
+++ b/macros/latex/contrib/nostarch/tabletest.pdf
Binary files differ
diff --git a/macros/latex/contrib/nostarch/tabletest.tex b/macros/latex/contrib/nostarch/tabletest.tex
new file mode 100644
index 0000000000..b1e28864db
--- /dev/null
+++ b/macros/latex/contrib/nostarch/tabletest.tex
@@ -0,0 +1,215 @@
+\documentclass[cfonts, nofontsdir]{nostarch}
+\usepackage{nshyper}
+\begin{document}
+
+Some examples of tables
+
+
+\begin{table}[H]
+\caption{Similar to Figures, Table Titles Also Should Break Within the Table's Width Instead of Extending the Full Page Width Like This}\index{kinds, meanings of}
+\label{exampletable}
+\begin{tabular}{ll}
+ \toprule
+ \thfont Col 1 & \thfont Col 2 \\
+ \midrule
+ Lorem ipsum & dolor sit amet \\
+ consectetur adipiscing & elit sed do \\
+ eiusmod tempor & incididunt ut \\
+ labore et dolore & magna aliqua \\
+ ut enim ad & minim veniam \\
+ \bottomrule
+\end{tabular}
+\end{table}
+
+A long table
+
+\begin{longtable}{ll}
+ \caption{A very long table. Its caption also wraps up like the
+ caption of figures and tables}\label{long table}\\
+ \toprule
+ \thfont Col 1 & \thfont Col 2 \\
+ \midrule
+ \endfirsthead
+ \caption[]{A very long table. Its caption also wraps up like the
+ caption of figures and tables continued\ldots}\\
+ \toprule
+ \thfont Col 1 & \thfont Col 2 \\
+ \midrule
+ \endhead
+ \bottomrule
+ \endfoot
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+ this table is & long! \\
+\end{longtable}
+
+Equations have unequal amounts of spacing above and below them. The
+space before the following equation looks roughly twice as large as
+after.
+\begin{equation}
+mean~tot = b + c ~ temp + d ~ temp^2.
+\end{equation}
+
+Additionally, the amount of space before/after equations is not always
+consistent. The below equation seems to have even more leading space
+than the previous one.
+\begin{equation}
+mean~tot = b + c ~ temp + d ~ temp^2 + e ~ hum + f ~ hum^2 + g ~ temp
+\times ~ hum.
+\end{equation}
+
+We've been manually adding \lstinline{\vspace} commands to account for this, which is not an ideal solution.
+
+
+\end{document}
diff --git a/macros/latex/contrib/nostarch/urltest.pdf b/macros/latex/contrib/nostarch/urltest.pdf
new file mode 100644
index 0000000000..152b9e7170
--- /dev/null
+++ b/macros/latex/contrib/nostarch/urltest.pdf
Binary files differ
diff --git a/macros/latex/contrib/nostarch/urltest.tex b/macros/latex/contrib/nostarch/urltest.tex
new file mode 100644
index 0000000000..56368a2ce7
--- /dev/null
+++ b/macros/latex/contrib/nostarch/urltest.tex
@@ -0,0 +1,8 @@
+\documentclass[cfonts, nofontsdir]{nostarch}
+\usepackage{nshyper}
+\begin{document}
+\url{https://bilbo.dynip.com/~boris}
+
+
+\fbox{\parbox{.8cm}{\url{https://bilbo.dynip.com/~boris_ddd=2345&aaaaaaa-b-c-c-c-cdddddddddd@ddddddddd!ddddd?dddddd|dddddd,ddddd;ddddd'dddddd+dddddd<aaaaaa>bbbbbb(aaaaaa)bbbbbb[aaaaaa]bbbbb{aaaaaa}bbbbb"aaaaaaaa:bbbbbbbbb///////////bbbbbbbbbbb}}}
+\end{document}