diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/sectionbreak |
Initial commit
Diffstat (limited to 'macros/latex/contrib/sectionbreak')
-rw-r--r-- | macros/latex/contrib/sectionbreak/CHANGELOG.md | 14 | ||||
-rw-r--r-- | macros/latex/contrib/sectionbreak/README.md | 110 | ||||
-rw-r--r-- | macros/latex/contrib/sectionbreak/sectionbreak-doc.pdf | bin | 0 -> 49309 bytes | |||
-rw-r--r-- | macros/latex/contrib/sectionbreak/sectionbreak-doc.tex | 39 | ||||
-rw-r--r-- | macros/latex/contrib/sectionbreak/sectionbreak-example.tex | 23 | ||||
-rw-r--r-- | macros/latex/contrib/sectionbreak/sectionbreak.sty | 75 |
6 files changed, 261 insertions, 0 deletions
diff --git a/macros/latex/contrib/sectionbreak/CHANGELOG.md b/macros/latex/contrib/sectionbreak/CHANGELOG.md new file mode 100644 index 0000000000..95eb430a5a --- /dev/null +++ b/macros/latex/contrib/sectionbreak/CHANGELOG.md @@ -0,0 +1,14 @@ +- 2019/03/11 version 0.1d + - fix for the Microtype error in the frozen TL 2018 +- 2019/02/07 + - fixed `Inconsolata` font name in the documentation + - added `skip` option + - added `disable` option +- 2018/01/03 version 0.1c + - added copyright and version info to the `sectionbreak.sty` file + - fixed small errors in the documentation +- 2018/01/03 Version 0.1b + - Fixed vertical position of the `\asterism` symbol + - Small fixes in the documentation +- 2018/01/03 Version 0.1a + - Initial version diff --git a/macros/latex/contrib/sectionbreak/README.md b/macros/latex/contrib/sectionbreak/README.md new file mode 100644 index 0000000000..b7b6348f8e --- /dev/null +++ b/macros/latex/contrib/sectionbreak/README.md @@ -0,0 +1,110 @@ +# The `sectionbreak` package + +This package provides LaTeX support for section breaks, used mainly in fiction +books to signal changes in a story, like changes in time, location, etc. +(Source: [Wikipedia](https://en.wikipedia.org/wiki/Section_(typography))). + + +## Package options + +There are several package options: + +`disable` + +: disable section break printing. + +`mark` + +: characters printed in the center of the section break. It is space by default, common value might be `***` for example. + +`asterism` + +: request [asterism](https://en.wikipedia.org/wiki/Asterism_(typography)) as a section mark. + +`preskip` + +: Amount of space printed before the section mark. It should be a dimension unit supported by TeX. + +`postskip` + +: Similar to `preskip`, but it is a space printed after the section mark. + +`skip` + +: Set both `preskip` and `postskip` to the same value. + +`style` + +: LaTeX commands for font style change, like `\bfseries`, for example. + +## Commands + +`\sectionbreak[<mark>]` + +: print the section break. Optional argument can contain content which should be printed in the break center. + +`\sectionbreakmark{<mark>}` + +: set the content printed in the following `\sectionbreak` commands. + +`\asterism` + +: print the asterism (\asterism) symbol. + +## The `tex4ht` support + +The `sectionbreak` package has support for `tex4ht`, so it is possible to use +this package in conversion to `HTML` or other formats supported by this +conversion system. It provides the following configurations: + +`\Configure{sectionbreak}{before section break }{after section}` + +: this configuration can be used for insertion of a box around the section break mark, which can be styled using CSS to print the blank space around the content. + +`\Configure{asterism}{code which replaces the asterism symbol}` + +: the asterism symbol is configured to use Unicode for it's rendering by default. This method might be unsupported by some devices like e-Ink readers, so it is possible to set a different code using this configuration. + +# Example + + + \documentclass[12pt]{article} + \usepackage[asterism]{sectionbreak} + \begin{document} + + Section separated by three exclamation marks. + \sectionbreak[!!!] + + Section separated by asterism section mark requested in \texttt{\textbackslash usepackage}. + \sectionbreak + + Section separated by a rule. + \sectionbreakmark{\rule{10em}{3pt}} + \sectionbreak + + + \end{document} + +% <img src="https://raw.githubusercontent.com/michal-h21/sectionbreak/master/sectionbreak-example.png" > + +% <!-- + +Section separated by three exclamation marks. +\sectionbreak[!!!] + +Section separated by asterism section mark requested in \texttt{\textbackslash usepackage}. +\sectionbreak + +Section separated by a rule. +\sectionbreakmark{\rule{10em}{3pt}} +\sectionbreak +% --> + +# License + +This package is copyright 2017--2018 Michal Hoftich. +It may be distributed and/or modified under the +conditions of the [LaTeX Project Public License](http://www.latex-project.org/lppl.txt), either version 1.3 +of this license or (at your option) any later version. +This work has the LPPL maintenance status `maintained'. + diff --git a/macros/latex/contrib/sectionbreak/sectionbreak-doc.pdf b/macros/latex/contrib/sectionbreak/sectionbreak-doc.pdf Binary files differnew file mode 100644 index 0000000000..0cea528aeb --- /dev/null +++ b/macros/latex/contrib/sectionbreak/sectionbreak-doc.pdf diff --git a/macros/latex/contrib/sectionbreak/sectionbreak-doc.tex b/macros/latex/contrib/sectionbreak/sectionbreak-doc.tex new file mode 100644 index 0000000000..dfef080af6 --- /dev/null +++ b/macros/latex/contrib/sectionbreak/sectionbreak-doc.tex @@ -0,0 +1,39 @@ +% přesunout do ~/texexamples/packages +\documentclass[a4page]{ltxdoc} +\usepackage{luatex85} +\usepackage[top=2cm, left=2.5cm, right=2.5cm,bottom=3cm]{geometry} +\usepackage[english]{babel} +\usepackage[asterism]{sectionbreak} +\usepackage[definitionLists=true,hybrid=true]{markdown} +\usepackage{fontspec} +\usepackage{luatexbase} % because of Microtype error: https://tex.stackexchange.com/a/476742/2891 +\usepackage{microtype} +\usepackage{hyperref} +\usepackage{lipsum} +\setmainfont{TeX Gyre Schola} +\setmonofont{Inconsolatazi4}[Scale=MatchLowercase] +\ifdefined\version\else\def\version{undefined}\fi +\ifdefined\gitdate\else\def\gitdate{undefined}\fi +\begin{document} +\title{The \texttt{sectionbreak} package\footnote{Version \version}} +\author{Michal Hoftich} +\date{\gitdate} +\maketitle +\tableofcontents +\markdownInput{README.md} +\section{Changelog} +\markdownInput{CHANGELOG.md} +% \lipsum[1-3] + +% \sectionbreak[!!!] + +% \lipsum[5-7] + +% \sectionbreak + +% \lipsum[1-2] +% \sectionbreakmark{\rule{10em}{3pt}} +% \sectionbreak + +% \lipsum[6-8] +\end{document} diff --git a/macros/latex/contrib/sectionbreak/sectionbreak-example.tex b/macros/latex/contrib/sectionbreak/sectionbreak-example.tex new file mode 100644 index 0000000000..b41978e5b6 --- /dev/null +++ b/macros/latex/contrib/sectionbreak/sectionbreak-example.tex @@ -0,0 +1,23 @@ +% přesunout do ~/texexamples/packages +\documentclass[12pt]{article} +\usepackage{luatex85} +\usepackage[paperwidth=30em, paperheight=26em,margin=2em]{geometry} +\parindent=0pt +% \usepackage[***,postskip=1em,preskip=1em]{sectionbreak} +\usepackage[asterism]{sectionbreak} +\pagestyle{empty} + +\begin{document} + +Section separated by three exclamation marks. +\sectionbreak[!!!] + +Section separated by asterism section mark requested in\\ \texttt{\textbackslash usepackage}. +\sectionbreak + +Section separated by a rule. +\sectionbreakmark{\rule{10em}{3pt}} +\sectionbreak + + +\end{document} diff --git a/macros/latex/contrib/sectionbreak/sectionbreak.sty b/macros/latex/contrib/sectionbreak/sectionbreak.sty new file mode 100644 index 0000000000..28b653b788 --- /dev/null +++ b/macros/latex/contrib/sectionbreak/sectionbreak.sty @@ -0,0 +1,75 @@ +% This is file sectionbreak.sty +%% (c) 2017--2018 Michal Hoftich +\ProvidesPackage{sectionbreak}[2019-03-11 v0.1d (Michal Hoftich)] +\RequirePackage{kvoptions} +\DeclareStringOption[\relax]{preskip} +\DeclareStringOption[\relax]{postskip} +\DeclareStringOption[\relax]{skip} +\DeclareStringOption[\relax]{style} +\DeclareStringOption[~]{mark} +\DeclareBoolOption{asterism} +\DeclareBoolOption{disable} + +\ProcessKeyvalOptions* + +% the skip option can be used to set both preskip and postskip + +\if\sectionbreak@skip\relax\else% + % set skips only if the options haven't been used + \if\sectionbreak@preskip\relax% + \def\sectionbreak@preskip{\sectionbreak@skip}% + \fi% + \if\sectionbreak@postskip\relax% + \def\sectionbreak@postskip{\sectionbreak@skip}% + \fi% +\fi + +% add default value for preskip +\if\sectionbreak@preskip\relax% + \def\sectionbreak@preskip{2em}% +\fi + +% add default value for postskip +\if\sectionbreak@postskip\relax% + \def\sectionbreak@postskip{2em}% +\fi + +\newdimen\asterism@width +% asterism is character which consists of three asterisks layed out as a triangel +\newcommand\asterism{% + \settowidth{\asterism@width}{*}% + % these values were found by trial and error + \raise-0.6\asterism@width\hbox{*\kern-.6\asterism@width\raise.7\asterism@width\hbox{*}\kern-.6\asterism@width*}% +} + +\newcommand\pre@sectionbreak{\par\vskip\sectionbreak@preskip\relax} +\newcommand\post@sectionbreak{\par\vskip\sectionbreak@postskip\relax} +% print centered section break mark +\newcommand\print@sectionbreak[1]{% + \bgroup% + \noindent\null\hfill\sectionbreak@style\hbox{#1}\hfill\null\par% + \egroup% +} +% default section break mark is an unbreakable space + +\newcommand\sectionbreak[1][\sectionbreak@mark]{% + \pre@sectionbreak% + \print@sectionbreak{#1}% + \post@sectionbreak% +} + +\newcommand\sectionbreakmark[1]{% + \gdef\sectionbreak@mark{#1}% +} + +% test the asterism option and set the section mark accordingly +\ifsectionbreak@asterism + \sectionbreakmark{\asterism} +\fi + +% disable the section break in the document with the `disable` option +\ifsectionbreak@disable% + \renewcommand\sectionbreak[1][]{}% +\fi + +\endinput |