diff options
author | Karl Berry <karl@freefriends.org> | 2015-05-13 21:33:22 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2015-05-13 21:33:22 +0000 |
commit | 7d00fa0a4bf524d8ce252a3948a7a49baaa15f17 (patch) | |
tree | 7ffa4782ac3c262a05013522b98e6c06776c999c /Master | |
parent | 9f28862d6cb8fd41c321dae74aba8d5603b2ccc2 (diff) |
hang (13may15)
git-svn-id: svn://tug.org/texlive/trunk@37383 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/doc/latex/hang/ChangeLog | 6 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/hang/README | 2 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/hang/hang.pdf | bin | 27758 -> 31286 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/hang/hang.tex | 61 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/hang/sample.pdf | bin | 0 -> 20058 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/hang/sample.tex | 71 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/hang/hang.sty | 68 |
7 files changed, 157 insertions, 51 deletions
diff --git a/Master/texmf-dist/doc/latex/hang/ChangeLog b/Master/texmf-dist/doc/latex/hang/ChangeLog index 69eeeac0c88..41dcae51f7f 100644 --- a/Master/texmf-dist/doc/latex/hang/ChangeLog +++ b/Master/texmf-dist/doc/latex/hang/ChangeLog @@ -1,2 +1,8 @@ +2015-05-13: + * control hanging indentation by \hangingindent length + * control left margin by \hangingleftmargin and \labeledleftmargin lengths + * sample file + * bump version to 2.0 + 2014-07-31: * initial release diff --git a/Master/texmf-dist/doc/latex/hang/README b/Master/texmf-dist/doc/latex/hang/README index d3892ff3568..0d2c1d9a231 100644 --- a/Master/texmf-dist/doc/latex/hang/README +++ b/Master/texmf-dist/doc/latex/hang/README @@ -1,4 +1,4 @@ -The "hang" LaTeX package (version 1.0) +The "hang" LaTeX package (version 2.0) -------------------------------------- The "hang" package provides environments for hanging paragraphs and list items. diff --git a/Master/texmf-dist/doc/latex/hang/hang.pdf b/Master/texmf-dist/doc/latex/hang/hang.pdf Binary files differindex 4e88fd21f71..d01432bb568 100644 --- a/Master/texmf-dist/doc/latex/hang/hang.pdf +++ b/Master/texmf-dist/doc/latex/hang/hang.pdf diff --git a/Master/texmf-dist/doc/latex/hang/hang.tex b/Master/texmf-dist/doc/latex/hang/hang.tex index a536fa72906..3088ea626d4 100644 --- a/Master/texmf-dist/doc/latex/hang/hang.tex +++ b/Master/texmf-dist/doc/latex/hang/hang.tex @@ -1,8 +1,12 @@ \documentclass[a4paper]{ltxdoc} \usepackage{hang} -\newenvironment{example}{\medskip\small}{\medskip} -\newcommand{\lipsum}{Lorem ipsum dolor sit amet, consectetuer adipiscing elit. -Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis.} +\usepackage{polyglossia} +\setdefaultlanguage{english} +\setotherlanguage{latin} +\newenvironment{hangingexample}{\medskip\setlength{\hangingleftmargin}{1em}}{\medskip} +\newenvironment{labeledexample}{\medskip\setlength{\labeledleftmargin}{1em}}{\medskip} +\newcommand{\lipsum}{\textlatin{Lorem ipsum dolor sit amet, consectetuer +adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis.}} \setlength{\parindent}{1em} \setlength{\leftmargini}{\parindent} \frenchspacing @@ -12,7 +16,7 @@ Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis.} \title{\textsf{hang} -- environments for hanging \\ paragraphs and list items} \author{Andreas Nolda} -\date{2014/07/31 (v.\,1.0)} +\date{2015/05/13 (v.\,2.0)} \maketitle \noindent The \textsf{hang} package provides environments for hanging paragraphs @@ -24,17 +28,22 @@ list items. A \emph{hanging} paragraph or list item is a text block where all lines but the first one are indented by some \meta{length}: -\begin{example} +\begin{hangingexample} \begin{hangingpar} \lipsum \end{hangingpar} -\end{example} +\end{hangingexample} -\noindent In the following environments, the indentation \meta{length} is equal -to |\leftmargini|, which can be changed as follows: -\begin{quote} -|\setlength{\leftmargini}}{|\meta{length}|}| +\DescribeMacro{\hangingindent} In the following environments, the +indentation \meta{length} is controlled by the |\hangingindent| length, which +can be changed as follows: \begin{quote} +|\setlength{\hangingindent}{|\meta{length}|}| \end{quote} +By default, it is set to |1em|. + +\DescribeMacro{\hangingleftmargin} The left margin of the whole hanging +paragraph or list item equals the |\hangingleftmargin| length, which defaults to +zero. In the above example, it is set to |1em| with |\setlength|. \subsection{Hanging paragraphs} @@ -48,37 +57,43 @@ hanging paragraphs: \subsection{Hanging list items} -\DescribeMacro{hangingpar} The |hanginglist| environment sets one or more -hanging list items, with effectively zero left margin: +\DescribeMacro{hanginglist} The |hanginglist| environment sets one or more +hanging list items: \begin{quote} |\begin{hanginglist}| \\ -|\item|\meta{text} \\ +|\item |\meta{text} \\ \vdots \\ |\end{hanginglist}| \end{quote} +\pagebreak \DescribeMacro{compacthang} The |compacthang| environment sets one or more -hanging list items, with zero left margin and without vertical space: +hanging list items without vertical space: \begin{quote} |\begin{compacthang}| \\ -|\item|\meta{text} \\ +|\item |\meta{text} \\ \vdots \\ |\end{compacthang}| \end{quote} \section{Labeled paragraphs and list items} -A \emph{labeled} paragraph or list item consist of a \meta{label} and an -indented text block: +A \emph{labeled} paragraph or list item consist of a \meta{label} and a text +block, which is indented by some \meta{length}: -\begin{example} +\begin{labeledexample} \begin{labeledpar}{\meta{label}}{\meta{label}} \lipsum \end{labeledpar} -\end{example} +\end{labeledexample} + +The following environments set the indentation \meta{length} to the width of +their \meta{widest\textunderscore label} argument. -\noindent The following environments set the indentation to the width of their -\meta{widest\textunderscore label} argument. +\DescribeMacro{\labeledleftmargin} The left margin of the whole labeled +paragraph or list item (including the \meta{label}) equals the +|\labeledleftmargin| length, which defaults to zero, too. In the above example, +it is again set to |1em|. \subsection{Labeled paragraphs} @@ -93,7 +108,7 @@ labeled paragraphs: \subsection{Labeled list items} \DescribeMacro{labeledlist} The |labeledlist| environment sets one or more -labeled list items, with effectively zero left margin: +labeled list items: \begin{quote} |\begin{labeledlist}{|\meta{widest\textunderscore label}|}| \\ |\item[|\meta{label}|]|\meta{text} \\ @@ -102,7 +117,7 @@ labeled list items, with effectively zero left margin: \end{quote} \DescribeMacro{compactlabel} The |compactlabel| environment sets one or more -labeled list items, with zero left margin and without vertical space: +labeled list items without vertical space: \begin{quote} |\begin{compactlabel}{|\meta{widest\textunderscore label}|}| \\ |\item[|\meta{label}|]|\meta{text} \\ diff --git a/Master/texmf-dist/doc/latex/hang/sample.pdf b/Master/texmf-dist/doc/latex/hang/sample.pdf Binary files differnew file mode 100644 index 00000000000..5dccc66e6dd --- /dev/null +++ b/Master/texmf-dist/doc/latex/hang/sample.pdf diff --git a/Master/texmf-dist/doc/latex/hang/sample.tex b/Master/texmf-dist/doc/latex/hang/sample.tex new file mode 100644 index 00000000000..56b1b3500bb --- /dev/null +++ b/Master/texmf-dist/doc/latex/hang/sample.tex @@ -0,0 +1,71 @@ +\documentclass[a4paper]{ltxdoc} +\usepackage{hang} +\usepackage{polyglossia} +\setdefaultlanguage{english} +\setotherlanguage{latin} +\newcommand{\lipsumone}{\textlatin{Lorem ipsum dolor sit amet, consectetuer +adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, +felis.}} +\newcommand{\lipsumtwo}{\textlatin{Curabitur dictum gravida mauris. Nam arcu +libero, nonummy eget, consectetuer id, vulputate a, magna. Donec vehicula augue +eu neque.}} +\setlength{\parindent}{1em} + +\frenchspacing +\sloppy + +\begin{document} +\title{Sample use of the \textsf{hang} package} +\author{Andreas Nolda} +\date{2015/05/13} +\maketitle + +\section{Hanging paragraphs and list items} + +\subsection{Hanging paragraphs} + +\begin{hangingpar} +\DescribeMacro{hangingpar}\lipsumone +\end{hangingpar} +\begin{hangingpar} +\DescribeMacro{hangingpar}\lipsumtwo +\end{hangingpar} + +\subsection{Hanging list items} + +\begin{hanginglist} +\item\DescribeMacro{hanginglist}\lipsumone +\item\lipsumtwo +\end{hanginglist} + +\begin{compacthang} +\item\DescribeMacro{compacthang}\lipsumone +\item\lipsumtwo +\end{compacthang} + +\section{Labeled paragraphs and list items} + +\subsection{Labeled paragraphs} + +\begin{labeledpar}{Label 10}{Label 9} +\DescribeMacro{labeledpar}\lipsumone +\end{labeledpar} +\begin{labeledpar}{Label 10}{Label 10} +\DescribeMacro{labeledpar}\lipsumtwo +\end{labeledpar} + +\subsection{Labeled list items} + +\begin{labeledlist}{Label 10} +\item[Label 9]\DescribeMacro{labeledlist}\lipsumone +\item[Label 10]\lipsumtwo +\end{labeledlist} + +\pagebreak +\begin{compactlabel}{Label 10} +\item[Label 9]\DescribeMacro{compactlabel}\lipsumone +\item[Label 10]\lipsumtwo +\end{compactlabel} + + +\end{document} diff --git a/Master/texmf-dist/tex/latex/hang/hang.sty b/Master/texmf-dist/tex/latex/hang/hang.sty index 137478befc3..6933b6bbf60 100644 --- a/Master/texmf-dist/tex/latex/hang/hang.sty +++ b/Master/texmf-dist/tex/latex/hang/hang.sty @@ -1,9 +1,9 @@ -\ProvidesPackage{hang}[2014/07/31 v1.0 Hanging paragraphs and list items] +\ProvidesPackage{hang}[2015/05/13 v2.0 Hanging paragraphs and list items] -% Copyright (C) 2014 Andreas Nolda +% Copyright (C) 2015 Andreas Nolda % Author: Andreas Nolda <andreas@nolda.org> -% Version: 1.0 +% Version: 2.0 % This work may be distributed and/or modified under the conditions of the LaTeX % Project Public License, either version 1.3 of this license or (at your option) @@ -11,31 +11,57 @@ % http://www.latex-project.org/lppl.txt and version 1.3 or later is part of all % distributions of LaTeX version 2005/12/01 or later. +\newlength{\hangingindent} +\newlength{\hangingleftmargin} +\newlength{\labeledleftmargin} + +\setlength{\hangingindent}{1em} +\setlength{\hangingleftmargin}{\z@} +\setlength{\labeledleftmargin}{\z@} + +\newenvironment{hangingpar}% + {\begin{list}{}% + {\setlength{\leftmargin}{\hangingleftmargin}% + \addtolength{\leftmargin}{\hangingindent}% + \setlength{\itemindent}{-\hangingindent}% + \setlength{\partopsep}{\z@}% + \setlength{\parsep}{\z@}% + \setlength{\itemsep}{\z@}% + \setlength{\topsep}{\z@}} + \item{}}% + {\end{list}} + \newenvironment{hanginglist}% {\begin{list}{}% - {\setlength{\leftmargin}{0.5\leftmargini}% - \setlength{\itemindent}{-0.5\leftmargini}% + {\setlength{\leftmargin}{\hangingleftmargin}% + \addtolength{\leftmargin}{\hangingindent}% + \setlength{\itemindent}{-\hangingindent}% \setlength{\partopsep}{\z@}}}% {\end{list}} \newenvironment{compacthang}% {\begin{list}{}% - {\setlength{\leftmargin}{0.5\leftmargini}% - \setlength{\itemindent}{-0.5\leftmargini}% + {\setlength{\leftmargin}{\hangingleftmargin}% + \addtolength{\leftmargin}{\hangingindent}% + \setlength{\itemindent}{-\hangingindent}% \setlength{\partopsep}{\z@}% \setlength{\parsep}{\z@}% \setlength{\itemsep}{\z@}}}% {\end{list}} -\newenvironment{hangingpar}% +\newenvironment{labeledpar}[2]% {\begin{list}{}% - {\setlength{\leftmargin}{0.5\leftmargini}% - \setlength{\itemindent}{-0.5\leftmargini}% + {\renewcommand{\makelabel}[1]{##1\hfil}% + \settowidth{\labelwidth}{#1}% + \setlength{\labelsep}{1em}% + \setlength{\leftmargin}{\labeledleftmargin}% + \addtolength{\leftmargin}{\labelwidth}% + \addtolength{\leftmargin}{\labelsep}% \setlength{\partopsep}{\z@}% \setlength{\parsep}{\z@}% \setlength{\itemsep}{\z@}% \setlength{\topsep}{\z@}} - \item{}}% + \item[#2]{}}% {\end{list}} \newenvironment{labeledlist}[1]% @@ -43,7 +69,8 @@ {\renewcommand{\makelabel}[1]{##1\hfil}% \settowidth{\labelwidth}{#1}% \setlength{\labelsep}{1em}% - \setlength{\leftmargin}{\labelwidth}% + \setlength{\leftmargin}{\labeledleftmargin}% + \addtolength{\leftmargin}{\labelwidth}% \addtolength{\leftmargin}{\labelsep}% \setlength{\partopsep}{\z@}}}% {\end{list}} @@ -53,23 +80,10 @@ {\renewcommand{\makelabel}[1]{##1\hfil}% \settowidth{\labelwidth}{#1}% \setlength{\labelsep}{1em}% - \setlength{\leftmargin}{\labelwidth}% + \setlength{\leftmargin}{\labeledleftmargin}% + \addtolength{\leftmargin}{\labelwidth}% \addtolength{\leftmargin}{\labelsep}% \setlength{\partopsep}{\z@}% \setlength{\parsep}{\z@}% \setlength{\itemsep}{\z@}}}% {\end{list}} - -\newenvironment{labeledpar}[2]% - {\begin{list}{}% - {\renewcommand{\makelabel}[1]{##1\hfil}% - \settowidth{\labelwidth}{#1}% - \setlength{\labelsep}{1em}% - \setlength{\leftmargin}{\labelwidth}% - \addtolength{\leftmargin}{\labelsep}% - \setlength{\partopsep}{\z@}% - \setlength{\parsep}{\z@}% - \setlength{\itemsep}{\z@}% - \setlength{\topsep}{\z@}} - \item[#2]{}}% - {\end{list}} |