summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/tagpair/tagpair.sty
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/tagpair/tagpair.sty
Initial commit
Diffstat (limited to 'macros/latex/contrib/tagpair/tagpair.sty')
-rw-r--r--macros/latex/contrib/tagpair/tagpair.sty51
1 files changed, 51 insertions, 0 deletions
diff --git a/macros/latex/contrib/tagpair/tagpair.sty b/macros/latex/contrib/tagpair/tagpair.sty
new file mode 100644
index 0000000000..ba5de69bf6
--- /dev/null
+++ b/macros/latex/contrib/tagpair/tagpair.sty
@@ -0,0 +1,51 @@
+\ProvidesPackage{tagpair}[2016/02/03 v1.1 Word-by-word glosses, translations,
+and bibliographic attributions]
+
+% Copyright (C) 2016 Andreas Nolda
+
+% Author: Andreas Nolda <andreas@nolda.org>
+% Version: 1.1
+
+% 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)
+% any later version. The latest version of this license is in
+% 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.
+
+% The following code is inspired by Marcel R. van der Goot's classic "gloss.tex".
+
+\RequirePackage{varwidth}
+
+\newsavebox{\t@g}
+\newsavebox{\p@irs}
+
+% cf. the "\narrowragged" command in the "varwidth" package
+\newcommand{\narrowraggedleft}{\rightskip\z@skip%
+ \leftskip\z@ plus \hsize%
+ \parfillskip\z@skip}
+
+\newenvironment{taggedline}[2][0.75]%
+ {\def\linewidthfactor{#1}%
+ \savebox{\t@g}{#2}%
+ \ignorespaces}%
+ {\unskip%
+ \hfil\penalty0%
+ \hskip1em%
+ \hbox{}%
+ \nobreak%
+ \hfill%
+ \begin{varwidth}[t]{\linewidthfactor\linewidth}
+ \narrowraggedleft\strut\unhbox\t@g
+ \end{varwidth}}
+
+\newenvironment{pairingline}%
+ {\begin{lrbox}{\p@irs}}%
+ {\end{lrbox}%
+ \unhbox\p@irs}
+
+\newcommand{\pairing}[2]%
+ {\vtop{\hbox{\strut\smash{#1}}%
+ \hbox{\strut\smash{#2}}}}
+
+\newcommand{\bottomline}[1]%
+ {\par\nopagebreak\noindent #1}