summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2016-03-21 20:46:28 +0000
committerKarl Berry <karl@freefriends.org>2016-03-21 20:46:28 +0000
commit5623abb74e370058ba885a4863c704d085cc7adf (patch)
tree3ef1fe8203e7f52bc60190173223eaae33535911 /Master/texmf-dist/source/latex
parent0005b42bbfad303131a7ac98274fc34e3e3b804c (diff)
metrix (21mar16)
git-svn-id: svn://tug.org/texlive/trunk@40099 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex')
-rw-r--r--Master/texmf-dist/source/latex/metrix/metrix.dtx220
1 files changed, 183 insertions, 37 deletions
diff --git a/Master/texmf-dist/source/latex/metrix/metrix.dtx b/Master/texmf-dist/source/latex/metrix/metrix.dtx
index bc9def105ce..09ad4f820f2 100644
--- a/Master/texmf-dist/source/latex/metrix/metrix.dtx
+++ b/Master/texmf-dist/source/latex/metrix/metrix.dtx
@@ -27,8 +27,8 @@
%<package> }
\def\metrixFileName{metrix}
\def\metrixFileDescription{Typset prosody/metric symbols.}
-\def\metrixFileDate{2016/01/21}
-\def\metrixFileVersion{1.2a}
+\def\metrixFileDate{2016/03/21}
+\def\metrixFileVersion{1.3}
%</driver|package>
%<*driver>
\documentclass[full,english]{l3doc}
@@ -71,6 +71,8 @@
\usepackage[scale=0.875]{tgheros}
\usepackage{ascii}
+\edef\pluschar{+}
+
\AtBeginDocument{
\DeleteShortVerb{\|}
\DeleteShortVerb{\"}
@@ -168,7 +170,7 @@
% \url{https://github.com/tweh/metrix} to request features and report bugs or
% send me an e-mail (\mail{mail@tobiw.de}).
%
-% Please note that I don?t speak latin myself and fo that the examples in this manual
+% Please note that I don't speak latin myself and forthat the examples in this manual
% may be wrong---as long as they show how to use the package I don't consider such
% errors as bugs +;-)+.
%
@@ -201,7 +203,9 @@
% +oo+ & two lowercase o's & \metricsymbols{oo} & aeolic base \\
% +|+ & pipe & \metricsymbols{|} & break (see \ref{sec:breaks}) \\
% +||+ & two pipes & \metricsymbols{||} & verse break (see \ref{sec:breaks}) \\
-% +'+ & apostrophe & \metricsymbols{'} & shorter break (see \ref{sec:breaks}) \\
+% +'+ & apostrophe (shift\,\pluschar\,\#) & \metricsymbols{'} &
+% shorter break (see \ref{sec:breaks}) \\
+% +,+ & comma & \metricsymbols{,} & shorter break (see \ref{sec:breaks}) \\
% \bottomrule
% \end{tabu}
% \end{table}
@@ -277,8 +281,8 @@
% {flos ve-te-ris vi-ni | meis na-ri-bus ob ||}
% \end{example}
% If you want the breaks to be shown in the symbol line only you can use the
-% shorter break which is represented by an apostrophe, i.e. +'+.
-% This mark must be used in \meta{symbols} only and is kind of special:
+% shorter break which is represented by an apostrophe (shift\,\pluschar\,\#)
+% or a comma. This mark must be used in \meta{symbols} only and is kind of special:
% \begin{itemize}
% \item It \emph{can't} be highlighted and thus doesn't count for the numbers used
% for highlights,
@@ -294,6 +298,26 @@
% \metrics{_ u u ' _ u u ' _ _ ' _ _ | _ u u | _ _ ||}
% {Ar-ma vi-rum-que ca-no Tro-iae qui | pri-mus ab | o-ris ||}
% \end{example}
+% The difference between +'+ and +,+ is that the break defined with an apostrophe
+% is vertically centred between the surrounding symbols while the break set with
+% the comma is vertically centred between the corresponding syllables. They both
+% align horizontally within the row of symbols.
+% \begin{example}
+% \begin{verbatim}
+% \emph{apostrophe:}
+% \metrics{_ _ ' _ }
+% {au-ra-{r\bow{um e}st}} \qquad
+% \emph{comma:}
+% \metrics{_ _ , _ }
+% {au-ra-{r\bow{um e}st}}
+% \end{verbatim}
+% \emph{apostrophe:}
+% \metrics{_ _ ' _ }
+% {au-ra-{r\bow{um e}st}} \qquad
+% \emph{comma:}
+% \metrics{_ _ , _ }
+% {au-ra-{r\bow{um e}st}}
+% \end{example}
%
% \subsection{Highlight certain symbols/syllabels}
% As you can see above \cs{metrics} and \cs{metricsymbols} got an optional argument taking
@@ -307,6 +331,23 @@
% \metrix/ comes with several predefined highlighting styles:
% \DeleteShortVerb{\+}
% \begin{itemize}
+% \item \textbf{\texttt{add arrow}}\\[2ex]
+% \metrics[3+8={add arrow}]{_ u u _ _ _ | _ _ u u _ ||}
+% {flos ve-te-ris vi-ni | meis na-ri-bus ob ||}\hfill
+% \metricsymbols[2={add arrow}]{u u_uu x _ | u _ n ||}
+%
+% This style adds an arrow above the metric symbol. To change the arrow symbol, edit
+% the variable \verb+metrix+.
+%
+% \item \textbf{\texttt{add text}=}\meta{text}\\[2ex]
+% \metrics[3+8={add text=shout!}]{_ u u _ _ _ | _ _ u u _ ||}
+% {flos ve-te-ris vi-ni | meis na-ri-bus ob ||}\hfill
+% \metricsymbols[2={add text=whisper}]{u u_uu x _ | u _ n ||}
+%
+% This style takes a \emph{mandatory} argument to add some text above a symbol.
+% To change the default font change the font of the \TikZ/ node style
+% \verb|every metrix added text|.
+%
% \item \textbf{\texttt{bold highlight}}\\[2ex]
% \metrics[2+5+9+13={bold highlight}]{_ u u _ _ _ | _ _ u u _ ||}
% {flos ve-te-ris vi-ni | meis na-ri-bus ob ||}\hfill
@@ -403,7 +444,7 @@
% \metricsymbols[6={superscript=5},10={colored highlight,superscript=bD}]
% {_ _uu _ _uu _ | _uu _ _uu || _ uu _ u_}
% \end{verbatim}
-% \metricsymbols[6={superscript=5},10={bold highlight,superscript=bD}]
+% \metricsymbols[6={superscript=5},10={colored highlight,superscript=bD}]
% {_ _uu _ _uu _ | _uu _ _uu || _ uu _ u_}
% \end{example}
%
@@ -870,6 +911,8 @@
% \rowfont{\bfseries\sffamily} variable & default & explanation \\
% \midrule
% \endfirsthead
+% \caption{Variables (cont.)}\\
+% \toprule
% \rowfont{\bfseries\sffamily} variable & default & explanation \\
% \midrule
% \endhead
@@ -908,6 +951,7 @@
% used in +colored highlight+ style \\
% +fillcolor+ & +yellow+ & color of filled symbol +node+s
% used in +filled highlight+ style \\
+% +arrow+ & +\$+\cs{downarrow}+\$+ & arrow for highlighting \\
% +breakgap+ & +0.6em+ & gap before and after a (verse) break \\
% +emptywidth+ & +1em+ & gap replacing an empty symbol (abbreviation +e+) \\
% \end{longtabu}
@@ -937,6 +981,9 @@
% \begin{variable}{every superscript picture,every superscript node,every superscript label}
% These styles are used to define the +superscript+ highlighting style.
% \end{variable}
+% \begin{variable}{every metrix added text}
+% This style is used for text added to a symbol with the +add text+ highlighting.
+% \end{variable}
%
% \end{documentation}
%
@@ -1141,6 +1188,15 @@
\tl_set:Nn \g_@@_variable_fillcolor_tl { yellow }
% \end{macrocode}
% \end{variable}
+% \begin{variable}[internal]
+% {\g_@@_variable_arrow_tl}
+% \changes{v1.3}{2016/03/21}{New variable for arrow}
+% These variable stores the color used in the +filled highlight+ style.
+% \begin{macrocode}
+\tl_new:N \g_@@_variable_arrow_tl
+\tl_set:Nn \g_@@_variable_arrow_tl { $\downarrow$ }
+% \end{macrocode}
+% \end{variable}
% \begin{variable}[internal]{\g_@@_variable_breakgap_tl}
% This variable stores the width of the gap around the two break symbols.
% \begin{macrocode}
@@ -1173,10 +1229,11 @@
\seq_new:N \l_@@_symbols_seq
% \end{macrocode}
% \end{variable}
-% \begin{variable}[internal]{\l_@@_symbols_seq}
-% This list stores the short breaks of \cs{metrics}.
+% \begin{variable}[internal]{\l_@@_short_breaks_seq,\l_@@_foot_breaks_seq}
+% This list stores the short and foot breaks of \cs{metrics}.
% \begin{macrocode}
\seq_new:N \l_@@_short_breaks_seq
+\seq_new:N \l_@@_foot_breaks_seq
% \end{macrocode}
% \end{variable}
% \begin{variable}[internal]{\l_@@_highlights_prop}
@@ -1229,6 +1286,7 @@
% \subsection{Internal main macros}
% \begin{macro}[internal,updated=2014/07/02]{\@@_metrics:nn}
% \changes{v1.1}{2014/07/02}{Made short breaks available}
+% \changes{v1.3}{2016/03/16}{Extended short breaks feature}
% This macro processes the two lists of \cs{metrics} and combines the symbols
% and syllables.\footnote{The framing of this macro was provided by Enrico Gregorio at
% \url{http://tex.stackexchange.com/q/124528/4918}, a follow up question
@@ -1253,18 +1311,24 @@
% \begin{macrocode}
\seq_set_split:Nnx \l_@@_symbols_seq { ~ } { \tl_trim_spaces:n { #1 } }
% \end{macrocode}
-% Search for the short breaks and remove them afterwards.
+% Search for the short and foot breaks and remove them afterwards.
% \begin{macrocode}
\int_zero:N \l_@@_process_int
\seq_clear:N \l_@@_short_breaks_seq
+ \seq_clear:N \l_@@_foot_breaks_seq
\seq_map_inline:Nn \l_@@_symbols_seq {
\int_incr:N \l_@@_process_int
\tl_if_eq:nnT { ##1 } { ' } {
- \seq_put_right:Nx \l_@@_short_breaks_seq { \int_use:N \l_@@_process_int }
- \int_decr:N \l_@@_process_int
+ \seq_put_right:Nx \l_@@_short_breaks_seq { \int_use:N \l_@@_process_int }
+ \int_decr:N \l_@@_process_int
+ }
+ \tl_if_eq:nnT { ##1 } { , } {
+ \seq_put_right:Nx \l_@@_foot_breaks_seq { \int_use:N \l_@@_process_int }
+ \int_decr:N \l_@@_process_int
+ }
}
+ \seq_remove_all:Nn \l_@@_symbols_seq { , }
\seq_remove_all:Nn \l_@@_symbols_seq { ' }
-}
% \end{macrocode}
% Test whether both lists got the same length:
% \begin{macrocode}
@@ -1339,6 +1403,31 @@
}
}
}
+% \end{macrocode}
+% And add the foot break symbols if necessary:
+% \begin{macrocode}
+ \seq_if_empty:NF \l_@@_foot_breaks_seq {
+ \seq_map_inline:Nn \l_@@_foot_breaks_seq {
+ \int_set:Nn \l_tmpa_int { ##1 - 1 }
+ \bool_if:nF {
+ \int_compare_p:n
+ { 0 = \l_tmpa_int }
+ ||
+ \int_compare_p:n
+ { \seq_count:N \l_@@_symbols_seq = \l_tmpa_int }
+ } {
+ \tikz [remember~picture, overlay] {
+ \coordinate (l_@@_tmp_coord) at
+ ($(l_@@_syllable_node_\int_use:N \l_tmpa_int.east)!
+ 0.5!(l_@@_syllable_node_##1.west)$);
+ \node [every~metrix~symbol~node] at
+ ($(l_@@_symbol_node_\int_use:N \l_tmpa_int.east)!
+ (l_@@_tmp_coord)!(l_@@_symbol_node_##1.west)$)
+ { \@@_foot_break: };
+ }
+ }
+ }
+ }
}
% \end{macrocode}
% Send an error, else.
@@ -1376,6 +1465,12 @@
}
\str_case:nnF { ##1 }
{
+ { , }
+ {
+ \@@_break_gap:
+ \@@_align_symbol:n { \@@_l_bigmark: }
+ \@@_break_gap:
+ }
{ ' }
{
\@@_break_gap:
@@ -1439,14 +1534,21 @@
\begin{tikzpicture}
[
remember~picture,
- baseline=(l_@@_syllable_node.base),
+ baseline=(l_@@_syllable_node_\int_use:N \l_@@_process_int.base),
]
- \node [every~metrix~syllable~node] (l_@@_syllable_node) {#1};
+ \node [every~metrix~syllable~node]
+ (l_@@_syllable_node_\int_use:N \l_@@_process_int)
+ { #1 };
\begin{pgfinterruptboundingbox}
\node [every~metrix~symbol~node]
(l_@@_symbol_node_\int_use:N \l_@@_process_int)
- at ($(l_@@_syllable_node.base)+(0,\usemetrixvar{symbolshift})
- +(\tl_use:N \l_@@_internal_itcorrection_tl,0)$)
+ at ($
+ (l_@@_syllable_node_\int_use:N \l_@@_process_int.base)
+ +
+ (0,\usemetrixvar{symbolshift})
+ +
+ (\tl_use:N \l_@@_internal_itcorrection_tl,0)
+ $)
{ \box_use:N \l_tmpa_box };
\end{pgfinterruptboundingbox}
\end{tikzpicture}
@@ -1484,7 +1586,7 @@
{
\PackageError{ \metrixFileName } { #1 }
{
- Please take a look at the manual or send an email.
+ Please~take~a~look~at~the~manual~or~send~an~email.
}
}
% \end{macrocode}
@@ -1521,7 +1623,7 @@
% \end{macrocode}
% \end{macro}
% \begin{macro}[internal]{\@@_break_gap:}
-% This macro typsets the gap around the two break symbols.
+% This macro typesets the gap around the two break symbols.
% \begin{macrocode}
\cs_new_protected:Npn \@@_break_gap:
{
@@ -1560,7 +1662,7 @@
% \end{macrocode}
% \end{macro}
% \begin{macro}[internal]{\@@_evaluate_higlights:N}
-% This macro typsets the gap around the two break symbols.
+% This macro evaluates and prints the highlighting options.
% \begin{macrocode}
\cs_new_protected:Npn \@@_evaluate_higlights:n #1
{
@@ -1885,7 +1987,7 @@
}
% \end{macrocode}
% \end{macro}
-% \begin{macro}[internal,added=2014/07/02]{\@@_short_break:}
+% \begin{macro}[internal]{\@@_short_break:}
% The shorter break symbol.
% \begin{macrocode}
\cs_new:Npn \@@_short_break:
@@ -1896,6 +1998,13 @@
}
% \end{macrocode}
% \end{macro}
+% \begin{macro}[internal]{\@@_foot_break:}
+% The shorter break symbol for foot breakt is the same as
+% the regular short break.
+% \begin{macrocode}
+\cs_set_eq:NN \@@_foot_break: \@@_short_break:
+% \end{macrocode}
+% \end{macro}
%
% \subsection{User level macros}
%
@@ -1957,29 +2066,34 @@
% \begin{macrocode}
\NewDocumentCommand { \lng } { D(){0,0} O{0pt} m O{0pt} }
{
- \begin{tikzpicture}[baseline=(l_@@_syllable_node.base),every~metrix~accent]
- \node [every~metrix~syllable~node] (l_@@_syllable_node) {#3};
+ \begin{tikzpicture}[
+ baseline = (l_@@_syllable_node_\int_use:N \l_@@_process_int.base),
+ every~metrix~accent
+ ]
+ \node [every~metrix~syllable~node]
+ (l_@@_syllable_node_\int_use:N \l_@@_process_int)
+ { #3 };
\begin{pgfinterruptboundingbox}
\draw [shorten~< = -#2, shorten~> = -#4]
- ($(l_@@_syllable_node.north)
+ ($(l_@@_syllable_node_\int_use:N \l_@@_process_int.north)
- (\usemetrixvar{lngminlength}/2,0)
+(\usemetrixvar{accentxshift},\usemetrixvar{lngshift})
+ (\tl_use:N \l_@@_internal_itcorrection_tl,0)
+ (#1)$)
--
- ($(l_@@_syllable_node.north)
+ ($(l_@@_syllable_node_\int_use:N \l_@@_process_int.north)
+ (\usemetrixvar{lngminlength}/2,0)
+(\usemetrixvar{accentxshift},\usemetrixvar{lngshift})
+ (\tl_use:N \l_@@_internal_itcorrection_tl,0)
+ (#1)$)
;
\draw [shorten~< = -#2, shorten~> = -#4]
- ($(l_@@_syllable_node.north~west)
+ ($(l_@@_syllable_node_\int_use:N \l_@@_process_int.north~west)
+(\usemetrixvar{lngshortening}+\usemetrixvar{accentxshift},\usemetrixvar{lngshift})
+ (\tl_use:N \l_@@_internal_itcorrection_tl,0)
+ (#1)$)
--
- ($(l_@@_syllable_node.north~east)
+ ($(l_@@_syllable_node_\int_use:N \l_@@_process_int.north~east)
+(-\usemetrixvar{lngshortening}+\usemetrixvar{accentxshift},\usemetrixvar{lngshift})
+ (\tl_use:N \l_@@_internal_itcorrection_tl,0)
+ (#1)$)
@@ -1995,10 +2109,16 @@
% \begin{macrocode}
\NewDocumentCommand { \brv } { D(){0,0} m }
{
- \begin{tikzpicture}[baseline=(l_@@_syllable_node.base),every~metrix~accent]
- \node [every~metrix~syllable~node] (l_@@_syllable_node) {#2};
+ \begin{tikzpicture}[
+ baseline = (l_@@_syllable_node_\int_use:N \l_@@_process_int.base),
+ every~metrix~accent
+ ]
+ \node [every~metrix~syllable~node]
+ (l_@@_syllable_node_\int_use:N \l_@@_process_int)
+ { #2 };
\begin{pgfinterruptboundingbox}
- \draw ($(l_@@_syllable_node.north)+(-0.15,0)
+ \draw ($(l_@@_syllable_node_\int_use:N \l_@@_process_int.north)
+ + (-0.15,0)
+ (\usemetrixvar{accentxshift},\usemetrixvar{brvshift})
+ (\tl_use:N \l_@@_internal_itcorrection_tl,0)
+ (#1)$)
@@ -2014,10 +2134,15 @@
% \begin{macrocode}
\NewDocumentCommand { \acct } { D(){0,0} m }
{
- \begin{tikzpicture}[baseline=(l_@@_syllable_node.base),every~metrix~accent]
- \node [every~metrix~syllable~node] (l_@@_syllable_node) {#2};
+ \begin{tikzpicture}[
+ baseline = (l_@@_syllable_node_\int_use:N \l_@@_process_int.base),
+ every~metrix~accent
+ ]
+ \node [every~metrix~syllable~node]
+ (l_@@_syllable_node_\int_use:N \l_@@_process_int)
+ { #2 };
\begin{pgfinterruptboundingbox}
- \fill ($(l_@@_syllable_node.south)
+ \fill ($(l_@@_syllable_node_\int_use:N \l_@@_process_int.south)
+ (0,\usemetrixvar{dotshift})
+ (#1)$)
circle [radius=1.25\pgflinewidth];
@@ -2032,12 +2157,18 @@
% \begin{macrocode}
\NewDocumentCommand { \bow } { O{0pt} m O{0pt} }
{
- \begin{tikzpicture}[baseline=(l_@@_syllable_node.base),every~metrix~bow]
- \node [every~metrix~syllable~node] (l_@@_syllable_node) {#2};
+ \begin{tikzpicture}[
+ baseline = (l_@@_syllable_node_\int_use:N \l_@@_process_int.base),
+ every~metrix~bow
+ ]
+ \node [every~metrix~syllable~node]
+ (l_@@_syllable_node_\int_use:N \l_@@_process_int)
+ { #2 };
\draw [shorten~< = #1, shorten~> = #3]
- ($(l_@@_syllable_node.base~west)+
+ ($(l_@@_syllable_node_\int_use:N \l_@@_process_int.base~west)+
(\usemetrixvar{bowshortening},\usemetrixvar{bowshift})$)
- to [out=-45, in=225,looseness=\usemetrixvar{bowlooseness}] ($(l_@@_syllable_node.base~east)+
+ to [out=-45, in=225,looseness=\usemetrixvar{bowlooseness}]
+ ($(l_@@_syllable_node_\int_use:N \l_@@_process_int.base~east)+
(-\usemetrixvar{bowshortening},\usemetrixvar{bowshift})$);
\end{tikzpicture}
}
@@ -2126,6 +2257,20 @@
},
},
superscript/.value required,
+ add arrow/.style={
+ every metrix symbol node/.append style={
+ label=90:\usemetrixvar{arrow},
+ },
+ },
+ add text/.style={
+ every metrix symbol node/.append style={
+ label={[every metrix added text]#1},
+ },
+ },
+ every metrix added text/.style = {
+ font = \scriptsize\itshape,
+ },
+ add text/.value required,
}
\ExplSyntaxOn
% \end{macrocode}
@@ -2197,5 +2342,6 @@
% ^^A use updated=YYYY-MM-DD or new=YYY-MM-DD in {documentation} section
% \changes{v1.0}{2013/08/12}{Initial version}
% \changes{v1.2a}{2016/01/21}{Replaced deprecated \cs{prop_get} variants (Thanks to J. Wright).}
+% \changes{v1.3}{2016/03/21}{New highlight styles: \texttt{add text} and \texttt{add arrow}}
%
% \PrintIndex^^A use: makeindex -s l3doc.ist -o metrix-doc.ind metrix-doc.idx \ No newline at end of file