summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2013-08-13 22:49:31 +0000
committerKarl Berry <karl@freefriends.org>2013-08-13 22:49:31 +0000
commit7b01a10cd6a2e1f25e7e56ae3d15a363c2bda441 (patch)
treead7aa5d874ad942d55a0d700d756f78fe90f657b /Master/texmf-dist/tex
parentf5ffdb9c55fd738e4fd0fb0c5f332a0faf540edc (diff)
metrix (13aug13)
git-svn-id: svn://tug.org/texlive/trunk@31425 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r--Master/texmf-dist/tex/latex/metrix/metrix.sty724
1 files changed, 724 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/metrix/metrix.sty b/Master/texmf-dist/tex/latex/metrix/metrix.sty
new file mode 100644
index 00000000000..20d4acccabc
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/metrix/metrix.sty
@@ -0,0 +1,724 @@
+%%
+%% This is file `metrix.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% metrix.dtx (with options: `package')
+%%
+%% IMPORTANT NOTICE:
+%%
+%% For the copyright see the source file.
+%%
+%% Any modified versions of this file must be renamed
+%% with new filenames distinct from metrix.sty.
+%%
+%% For distribution of the original source see the terms
+%% for copying and modification in the file metrix.dtx.
+%%
+%% This generated file may be distributed as long as the
+%% original source files, as listed above, are part of the
+%% same distribution. (The sources need not necessarily be
+%% in the same archive or directory.)
+%% File: metrix.dtx Copyright (C) 2013 Tobias Weh
+%%
+%% It may be distributed and/or modified under the conditions of the
+%% LaTeX Project Public License (LPPL), either version 1.3c of this
+%% license or (at your option) any later version. The latest version
+%% of this license is in the file
+%%
+%% http://www.latex-project.org/lppl.txt
+%%
+\RequirePackage{expl3}[2013/07/12]
+\@ifpackagelater{expl3}{2013/03/14}
+ {}
+ {%
+ \PackageError{metrix}{Support package l3kernel too old}
+ {%
+ Please install an up to date version of l3kernel\MessageBreak
+ using your TeX package manager or from CTAN.\MessageBreak
+ \MessageBreak
+ Loading xparse will abort!%
+ }%
+ \endinput
+ }
+\def\metrixFileName{metrix}
+\def\metrixFileDescription{Typset prosody/metric symbols.}
+\def\metrixFileDate{2013/08/12}
+\def\metrixFileVersion{1.0}
+\ProvidesExplPackage
+ {\metrixFileName}{\metrixFileDate}{\metrixFileVersion}{\metrixFileDescription}
+\RequirePackage{xparse}
+\RequirePackage{xpatch}
+\RequirePackage{tikz}
+\ExplSyntaxOff
+ \usetikzlibrary{calc}
+\ExplSyntaxOn
+\tl_new:N \g__metrix_variable_symbollinewidth_tl
+\tl_set:Nn \g__metrix_variable_symbollinewidth_tl { 0.04em }
+\tl_new:N \g__metrix_variable_bigsymbollinewidth_tl
+\tl_set:Nn \g__metrix_variable_bigsymbollinewidth_tl { 0.06em }
+\tl_new:N \g__metrix_variable_accentlinewidth_tl
+\tl_set:Nn \g__metrix_variable_accentlinewidth_tl { 0.04em }
+\tl_new:N \g__metrix_variable_bowlinewidth_tl
+\tl_set:Nn \g__metrix_variable_bowlinewidth_tl { 0.04em }
+\tl_new:N \g__metrix_variable_symbolsep_tl
+\tl_set:Nn \g__metrix_variable_symbolsep_tl { 0.4em }
+\tl_new:N \g__metrix_variable_baseunit_tl
+\tl_set:Nn \g__metrix_variable_baseunit_tl { 0.9em }
+\tl_new:N \g__metrix_variable_bigbaseunit_tl
+\tl_set:Nn \g__metrix_variable_bigbaseunit_tl { 1.4em }
+\tl_new:N \g__metrix_variable_gap_tl
+\tl_set:Nn \g__metrix_variable_gap_tl { 0.09em }
+\tl_new:N \g__metrix_variable_symbolshift_tl
+\tl_set:Nn \g__metrix_variable_symbolshift_tl { 1.1em }
+\tl_new:N \g__metrix_variable_lngshift_tl
+\tl_set:Nn \g__metrix_variable_lngshift_tl { 0.15em }
+\tl_new:N \g__metrix_variable_lngshortening_tl
+\tl_set:Nn \g__metrix_variable_lngshortening_tl { 0.075em }
+\tl_new:N \g__metrix_variable_lngminlength_tl
+\tl_set:Nn \g__metrix_variable_lngminlength_tl { 0.25em }
+\tl_new:N \g__metrix_variable_brvshift_tl
+\tl_set:Nn \g__metrix_variable_brvshift_tl { 0.25em }
+\tl_new:N \g__metrix_variable_dotshift_tl
+\tl_set:Nn \g__metrix_variable_dotshift_tl { -0.15em }
+\tl_new:N \g__metrix_variable_itcorrection_tl
+\tl_set:Nn \g__metrix_variable_itcorrection_tl { 0.11em }
+\tl_new:N \l__metrix_internal_itcorrection_tl
+\tl_set:Nn \l__metrix_internal_itcorrection_tl { 0em }
+\tl_new:N \g__metrix_internal_itcorrection_zero_tl
+\tl_set:Nn \g__metrix_internal_itcorrection_zero_tl { 0em }
+\tl_new:N \g__metrix_variable_accentxshift_tl
+\tl_set:Nn \g__metrix_variable_accentxshift_tl { -0.025em }
+\tl_new:N \g__metrix_variable_bowshift_tl
+\tl_set:Nn \g__metrix_variable_bowshift_tl { -0.15em }
+\tl_new:N \g__metrix_variable_bowshortening_tl
+\tl_set:Nn \g__metrix_variable_bowshortening_tl { 0.15em }
+\tl_new:N \g__metrix_variable_bowlooseness_tl
+\tl_set:Nn \g__metrix_variable_bowlooseness_tl { 0.75 }
+\tl_new:N \g__metrix_variable_symbolcolor_tl
+\tl_set:Nn \g__metrix_variable_symbolcolor_tl { black }
+\tl_new:N \g__metrix_variable_accentcolor_tl
+\tl_set:Nn \g__metrix_variable_accentcolor_tl { black }
+\tl_new:N \g__metrix_variable_bowcolor_tl
+\tl_set:Nn \g__metrix_variable_bowcolor_tl { black }
+\tl_new:N \g__metrix_variable_highlightcolor_tl
+\tl_set:Nn \g__metrix_variable_highlightcolor_tl { red }
+\tl_new:N \g__metrix_variable_fillcolor_tl
+\tl_set:Nn \g__metrix_variable_fillcolor_tl { yellow }
+\tl_new:N \g__metrix_variable_breakgap_tl
+\tl_set:Nn \g__metrix_variable_breakgap_tl { 0.6em }
+\tl_new:N \g__metrix_variable_emptywidth_tl
+\tl_set:Nn \g__metrix_variable_emptywidth_tl { 1em }
+\tl_new:N \l__metrix_words_tl
+\seq_new:N \l__metrix_syllables_seq
+\seq_new:N \l__metrix_symbols_seq
+\prop_new:N \l__metrix_highlights_prop
+\seq_new:N \l__metrix_highlight_seq
+\seq_new:N \l__metrix_highlight_pos_seq
+\quark_new:N \q__metrix_space_marker
+\int_new:N \l__metrix_process_int
+\bool_new:N \l__metrix_short_syllable_bool
+\box_new:N \l__metrix_syllable_box
+\tl_new:N \g__metrix_variable_shortsyllablelimit_tl
+\tl_set:Nn \g__metrix_variable_shortsyllablelimit_tl { 0.8em }
+\cs_generate_variant:Nn \prop_get:Nn { No , Nf , NV , Nx }
+\cs_generate_variant:Nn \prop_put:Nnn { Nnx , Nxx , Nff , Noo }
+\cs_generate_variant:Nn \seq_item:Nn { Nf , NV , Nx }
+\cs_generate_variant:Nn \seq_set_split:Nnn { Nnf , NnV , Nnx }
+\cs_new_protected:Npn \__metrix_metrics:nn #1 #2
+ {
+ \tl_set:Nx \l__metrix_words_tl { \tl_trim_spaces:n { #2 } }
+ \tl_replace_all:Nnn \l__metrix_words_tl { ~ } { - \q__metrix_space_marker - }
+ \seq_set_split:NnV \l__metrix_syllables_seq { - } \l__metrix_words_tl
+ \seq_set_split:Nnx \l__metrix_symbols_seq { ~ } { \tl_trim_spaces:n { #1 } }
+ \int_zero:N \l__metrix_process_int
+ \seq_map_inline:Nn \l__metrix_syllables_seq
+ {
+ \tl_if_eq:nnT { ##1 } { \q__metrix_space_marker }
+ { \int_incr:N \l__metrix_process_int }
+ }
+ \int_compare:nTF
+ {
+ \seq_count:N \l__metrix_syllables_seq -
+ \seq_count:N \l__metrix_symbols_seq = \l__metrix_process_int
+ }
+ {
+ \int_zero:N \l__metrix_process_int
+ \seq_map_inline:Nn \l__metrix_syllables_seq
+ {
+ \int_incr:N \l__metrix_process_int
+ \tl_if_eq:nnTF { ##1 } { \q__metrix_space_marker }
+ {
+ \int_add:Nn \l__metrix_process_int { -1 }
+ \c_space_token
+ }
+ {
+ \str_case:nnn { ##1 }
+ {
+ { | }
+ {
+ \__metrix_break_node:n { \__metrix_l_break: }
+ }
+ { || }
+ {
+ \__metrix_break_node:n { \__metrix_ll_break: }
+ }
+ }
+ {
+ \__metrix_print_syllable:n { ##1 }
+ }
+ }
+ }
+ }
+ {
+ \__metrix_error_msg:n
+ {
+ Numbers~of~symbols~(\seq_count:N \l__metrix_symbols_seq)~and~syllables~
+ (\int_eval:n
+ {
+ \seq_count:N \l__metrix_syllables_seq - \l__metrix_process_int
+ }
+ )~mismatch.
+ }
+ }
+ }
+\cs_new_protected:Npn \__metrix_metricsymbols:n #1
+ {
+ \seq_set_split:Nnx \l__metrix_symbols_seq { ~ } { \tl_trim_spaces:n { #1 } }
+ \int_zero:N \l__metrix_process_int
+ \seq_map_inline:Nn \l__metrix_symbols_seq
+ {
+ \int_incr:N \l__metrix_process_int
+ \int_compare:nT { \l__metrix_process_int > 1 }
+ {
+ \hspace{\usemetrixvar{symbolsep}}
+ }
+ \str_case:nnn { ##1 }
+ {
+ { | }
+ {
+ \__metrix_break_gap:
+ \__metrix_align_symbol:n { \__metrix_l_bigmark: }
+ \__metrix_break_gap:
+ }
+ { || }
+ {
+ \__metrix_break_gap:
+ \__metrix_align_symbol:n { \__metrix_ll_bigmark: }
+ \__metrix_break_gap:
+ }
+ }
+ {
+ \__metrix_align_symbol:n { \__metrix_print_symbol: }
+ }
+ }
+ }
+\cs_new_protected:Npn \__metrix_print_syllable:n #1
+ {
+ \group_begin:
+ \hbox_set:Nn \l__metrix_syllable_box { #1 }
+ \dim_compare:nTF { \box_wd:N \l__metrix_syllable_box < \g__metrix_variable_shortsyllablelimit_tl }
+ { \bool_set_true:N \l__metrix_short_syllable_bool }
+ { \bool_set_false:N \l__metrix_short_syllable_bool }
+ \cs_set:Npx \__metrix_current_highlight: {
+ \prop_get:NV \l__metrix_highlights_prop \l__metrix_process_int
+ }
+ \expandafter\tikzset\expandafter{\__metrix_current_highlight:}
+ \begin{tikzpicture}
+ [
+ baseline=(l__metrix_syllable_node.base),
+ ]
+ \node [every~metrix~syllable~node] (l__metrix_syllable_node) {#1};
+ \begin{pgfinterruptboundingbox}
+ \node [every~metrix~symbol~node]
+ at ($(l__metrix_syllable_node.base)+(0,\usemetrixvar{symbolshift})
+ +(\tl_use:N \l__metrix_internal_itcorrection_tl,0)$)
+ { \__metrix_print_symbol: };
+ \end{pgfinterruptboundingbox}
+ \end{tikzpicture}
+ \group_end:
+ }
+\cs_new_protected:Npn \__metrix_print_symbol:
+ {
+ \cs_if_exist_use:cF
+ {
+ __metrix_\seq_item:Nn \l__metrix_symbols_seq
+ { \l__metrix_process_int }_mark:
+ }
+ {
+ \__metrix_error_msg:n
+ {
+ Unknown~symbol~abbreviation~'\seq_item:Nn
+ \l__metrix_symbols_seq { \l__metrix_process_int }'.
+ }
+ }
+ }
+\cs_new_protected:Npn \__metrix_error_msg:n #1
+ {
+ \PackageError{ \metrixFileName } { #1 }
+ {
+ Please take a look at the manual or send an email.
+ }
+ }
+\cs_new_protected:Npn \__metrix_warning_msg:n #1
+ {
+ \PackageWarning{ \metrixFileName } { #1 }
+ }
+\cs_new_protected:Npn \__metrix_align_symbol:n #1
+ {
+ \group_begin:
+ \cs_set:Npx \__metrix_current_highlight: {
+ \prop_get:NV \l__metrix_highlights_prop \l__metrix_process_int
+ }
+ \expandafter\tikzset\expandafter{\__metrix_current_highlight:}
+ \begin{tikzpicture}
+ [
+ baseline={(0,-0.25*\usemetrixvar{baseunit})},
+ ]
+ \node [every~metrix~symbol~node] {#1};
+ \end{tikzpicture}
+ \group_end:
+ }
+\cs_new_protected:Npn \__metrix_break_gap:
+ {
+ \hspace{\usemetrixvar{breakgap}}
+ }
+
+\cs_new:Npn \__metrix_break_node:n #1
+ {
+ \group_begin:
+ \cs_set:Npx \__metrix_current_highlight: {
+ \prop_get:NV \l__metrix_highlights_prop \l__metrix_process_int
+ }
+ \expandafter\tikzset\expandafter{\__metrix_current_highlight:}
+ \tikz[baseline=(l__metrix_break_node.base)]
+ \node (l__metrix_break_node) [every~metrix~break~node] { #1 }
+ ;
+ \group_end:
+ }
+
+\cs_new_protected:Npn \__metrix_e_gap:
+ {
+ \hspace*{\usemetrixvar{emptywidth}}
+ }
+\cs_new_protected:Npn \__metrix_evaluate_higlights:n #1
+ {
+ \prop_clear:N \l__metrix_highlights_prop
+ \clist_map_inline:nn { #1 }
+ {
+ \seq_set_split:Nnn \l__metrix_highlight_seq { = } { ##1 }
+ \seq_set_split:Nnf \l__metrix_highlight_pos_seq { + }
+ {
+ \seq_item:Nn \l__metrix_highlight_seq { 1 }
+ }
+ \seq_map_inline:Nn \l__metrix_highlight_pos_seq
+ {
+ \prop_put:Nnx \l__metrix_highlights_prop
+ {
+ ####1
+ }
+ {
+ \seq_item:Nn \l__metrix_highlight_seq { 2 }
+ }
+ }
+ }
+ }
+\xpretocmd { \itshape }
+ {
+ \tl_set_eq:NN
+ \l__metrix_internal_itcorrection_tl
+ \g__metrix_variable_itcorrection_tl
+ }
+ { }
+ {
+ \__metrix_warning_msg:n { Could~not~patch~\string\itshape. }
+ }
+\xpretocmd { \slshape }
+ {
+ \tl_set_eq:NN
+ \l__metrix_internal_itcorrection_tl
+ \g__metrix_variable_itcorrection_tl
+ }
+ { }
+ {
+ \__metrix_warning_msg:n { Could~not~patch~\string\slshape. }
+ }
+\xpretocmd { \upshape }
+ {
+ \tl_set_eq:NN
+ \l__metrix_internal_itcorrection_tl
+ \g__metrix_internal_itcorrection_zero_tl
+ }
+ { }
+ {
+ \__metrix_warning_msg:n { Could~not~patch~\string\upshape. }
+ }
+\xpretocmd { \normalfont }
+ {
+ \tl_set_eq:NN
+ \l__metrix_internal_itcorrection_tl
+ \g__metrix_internal_itcorrection_zero_tl
+ }
+ { }
+ {
+ \__metrix_warning_msg:n { Could~not~patch~\string\normalfont. }
+ }
+\cs_new:Npn \__metrix_e_mark: { \__metrix_e_gap: }
+\cs_new:Npn \__metrix_u_mark:
+ {
+ \begin{tikzpicture}[every~metrix~symbol]
+ \draw (0,0) arc [start~angle=0, end~angle=180, radius=-0.225];
+ \end{tikzpicture}
+ }
+\cs_new:Npn \__metrix___mark:
+ {
+ \bool_if:NTF \l__metrix_short_syllable_bool
+ {
+ \begin{tikzpicture}[every~metrix~symbol]
+ \draw (0,0) -- ++(0.4,0);
+ \end{tikzpicture}
+ }
+ {
+ \begin{tikzpicture}[every~metrix~symbol]
+ \draw (0,0) -- ++(0.75,0);
+ \end{tikzpicture}
+ }
+ }
+\cs_new:Npn \__metrix_uu_mark:
+ {
+ \begin{tikzpicture}[every~metrix~symbol]
+ \draw (0,0) arc [start~angle=0, end~angle=180, radius=-0.2];
+ \draw ($(0.4,0)+(\pgflinewidth,0)+(\usemetrixvar{gap},0)$) arc
+ [start~angle=0, end~angle=180, radius=-0.2];
+ \end{tikzpicture}
+ }
+\cs_new:Npn \__metrix_uu__mark:
+ {
+ \begin{tikzpicture}[every~metrix~symbol]
+ \draw (0,0) arc [start~angle=0, end~angle=180, radius=-0.2];
+ \draw ($(0.4,0)+(\pgflinewidth,0)+(\usemetrixvar{gap},0)$) arc
+ [start~angle=0, end~angle=180, radius=-0.2];
+ \draw ($(0,-0.2)+(-0.5\pgflinewidth,-\pgflinewidth)-(0,\usemetrixvar{gap})$) --
+ ($(0.8,-0.2)+(1.5\pgflinewidth,-\pgflinewidth)
+ +(\usemetrixvar{gap},-\usemetrixvar{gap})$);
+ \end{tikzpicture}
+ }
+\cs_new:Npn \__metrix__uu_mark:
+ {
+ \begin{tikzpicture}[every~metrix~symbol]
+ \draw (0,0) arc [start~angle=0, end~angle=180, radius=-0.2];
+ \draw ($(0.4,0)+(\pgflinewidth,0)+(\usemetrixvar{gap},0)$) arc
+ [start~angle=0, end~angle=180, radius=-0.2];
+ \draw ($(0,0)+(-0.5\pgflinewidth,0.5\pgflinewidth)+(0,\usemetrixvar{gap})$) --
+ ($(0.8,0)+(1.5\pgflinewidth,0.5\pgflinewidth)
+ +(\usemetrixvar{gap},\usemetrixvar{gap})$);
+ \end{tikzpicture}
+ }
+\cs_new:Npn \__metrix_u_uu_mark:
+ {
+ \begin{tikzpicture}[every~metrix~symbol]
+ \draw (0,0) arc [start~angle=0, end~angle=180, radius=-0.2];
+ \draw ($(0.4,0)+(\pgflinewidth,0)+(\usemetrixvar{gap},0)$) arc
+ [start~angle=0, end~angle=180, radius=-0.2];
+ \draw ($(0,0)+(-0.5\pgflinewidth,0.5\pgflinewidth)+(0,\usemetrixvar{gap})$) --
+ ($(0.8,0)+(1.5\pgflinewidth,0.5\pgflinewidth)
+ +(\usemetrixvar{gap},\usemetrixvar{gap})$);
+ \draw ($(0.2,0.2)+(0.5\pgflinewidth,1.5\pgflinewidth)
+ +(0.5*\usemetrixvar{gap},2*\usemetrixvar{gap})$)
+ arc [start~angle=0, end~angle=180, radius=-0.2];
+ \end{tikzpicture}
+ }
+\cs_new:Npn \__metrix_x_mark:
+ {
+ \begin{tikzpicture}[every~metrix~symbol]
+ \draw (-0.2,0.2) -- (0.2,-0.2);
+ \draw (-0.2,-0.2) -- (0.2,0.2);
+ \end{tikzpicture}
+ }
+\cs_new:Npn \__metrix_oo_mark:
+ {
+ \begin{tikzpicture}[every~metrix~symbol]
+ \draw (0,0) circle [radius=0.2];
+ \draw ($(0.4,0)+(1\pgflinewidth,0)+(\usemetrixvar{gap},0)$) circle [radius=0.2];
+ \end{tikzpicture}
+ }
+\cs_new:Npn \__metrix_u__mark:
+ {
+ \begin{tikzpicture}[every~metrix~symbol]
+ \draw (0,0) arc [start~angle=0, end~angle=180, radius=-0.2];
+ \draw ($(0,-0.2)+(-0.5\pgflinewidth,-\pgflinewidth)-(0,\usemetrixvar{gap})$) --
+ ($(0.4,-0.2)+(0.5\pgflinewidth,-\pgflinewidth)
+ +(0,-\usemetrixvar{gap})$);
+ \fill [red] circle (0.2pt);
+ \end{tikzpicture}
+ }
+\cs_new:Npn \__metrix_n_mark:
+ {
+ \begin{tikzpicture}[every~metrix~symbol]
+ \draw (0,0) arc [start~angle=0, end~angle=180, radius=0.225];
+ \fill (-0.225,0.75*\usemetrixvar{symbollinewidth})
+ circle [radius=0.7\pgflinewidth];
+ \end{tikzpicture}
+ }
+\cs_new:Npn \__metrix_l_mark:
+ {
+ \begin{tikzpicture}[every~metrix~symbol]
+ \draw (0,0) -- (0,0.5);
+ \end{tikzpicture}
+ }
+\cs_new:Npn \__metrix_ll_mark:
+ {
+ \begin{tikzpicture}[every~metrix~symbol]
+ \draw (0,0) -- (0,0.5);
+ \draw ($(\pgflinewidth,0)+(1.5*\usemetrixvar{gap},0)$) -- ++(0,0.5);
+ \end{tikzpicture}
+ }
+\cs_new:Npn \__metrix_l_bigmark:
+ {
+ \begin{tikzpicture}[every~metrix~symbol]
+ \draw (0,0) -- (0,0.8);
+ \end{tikzpicture}
+ }
+\cs_new:Npn \__metrix_ll_bigmark:
+ {
+ \begin{tikzpicture}[every~metrix~symbol]
+ \draw (0,0) -- (0,0.8);
+ \draw ($(\pgflinewidth,0)+(1.5*\usemetrixvar{gap},0)$) -- ++(0,0.8);
+ \end{tikzpicture}
+ }
+\cs_new:Npn \__metrix_l_break:
+ {
+ \begin{tikzpicture}[every~metrix~symbol,baseline=0.05em]
+ \draw [shorten~<=-0.2em] (0,\usemetrixvar{symbolshift})
+ -- (0,0) -- (0,0.8em) -- (0,\usemetrixvar{symbolshift});
+ \end{tikzpicture}
+ }
+\cs_new:Npn \__metrix_ll_break:
+ {
+ \begin{tikzpicture}[every~metrix~symbol,baseline=0.05em]
+ \draw [shorten~<=-0.2em] (0,\usemetrixvar{symbolshift})
+ -- (0,0) -- (0,0.8em) -- (0,\usemetrixvar{symbolshift});
+ \draw
+ [
+ shift={($(\pgflinewidth,0)+(1.5*\usemetrixvar{gap},0)$)},
+ shorten~<=-0.2em,
+ ]
+ (0,\usemetrixvar{symbolshift}) -- (0,0) -- (0,0.8em)
+ -- (0,\usemetrixvar{symbolshift});
+ \end{tikzpicture}
+ }
+\NewDocumentCommand{ \setmetrixvar }{ m m }
+ {
+ \tl_if_exist:cTF { g__metrix_variable_#1_tl } {
+ \tl_set:cn { g__metrix_variable_#1_tl } { #2 }
+ }
+ {
+ \__metrix_error_msg:n { Unknown~variable~'#1'. }
+ }
+ }
+\DeclareExpandableDocumentCommand{ \usemetrixvar }{ m }
+ {
+ \tl_if_exist:cTF { g__metrix_variable_#1_tl } {
+ \tl_use:c { g__metrix_variable_#1_tl }
+ }
+ {
+ \__metrix_error_msg:n { Unknown~variable~'#1'. }
+ }
+ }
+\NewDocumentCommand { \metrics } { O{} m m }
+ {
+ \__metrix_evaluate_higlights:n { #1 }
+ \__metrix_metrics:nn { #2 } { #3 }
+ }
+\NewDocumentCommand { \metricsymbols } { s O{} m }
+ {
+ \group_begin:
+ \IfBooleanF { #1 } { \tikzset{every~metrix~symbol/.style={every~metrix~big~symbol}} }
+ \__metrix_evaluate_higlights:n { #2 }
+ \__metrix_metricsymbols:n { #3 }
+ \group_end:
+ }
+\NewDocumentCommand { \lng } { m }
+ {
+ \begin{tikzpicture}[baseline=(l__metrix_syllable_node.base),every~metrix~accent]
+ \node [every~metrix~syllable~node] (l__metrix_syllable_node) {#1};
+ \begin{pgfinterruptboundingbox}
+ \draw
+ ($(l__metrix_syllable_node.north)
+ - (\usemetrixvar{lngminlength}/2,0)
+ +(\usemetrixvar{accentxshift},\usemetrixvar{lngshift})
+ + (\tl_use:N \l__metrix_internal_itcorrection_tl,0)$)
+ --
+ ($(l__metrix_syllable_node.north)
+ + (\usemetrixvar{lngminlength}/2,0)
+ +(\usemetrixvar{accentxshift},\usemetrixvar{lngshift})
+ + (\tl_use:N \l__metrix_internal_itcorrection_tl,0)$)
+
+ ($(l__metrix_syllable_node.north~west)
+ +(\usemetrixvar{lngshortening}+\usemetrixvar{accentxshift},\usemetrixvar{lngshift})
+ + (\tl_use:N \l__metrix_internal_itcorrection_tl,0)$)
+ --
+ ($(l__metrix_syllable_node.north~east)
+ +(-\usemetrixvar{lngshortening}+\usemetrixvar{accentxshift},\usemetrixvar{lngshift})
+ + (\tl_use:N \l__metrix_internal_itcorrection_tl,0)$)
+ ;
+ \end{pgfinterruptboundingbox}
+ \end{tikzpicture}%
+ }
+\NewDocumentCommand { \brv } { m }
+ {
+ \begin{tikzpicture}[baseline=(l__metrix_syllable_node.base),every~metrix~accent]
+ \node [every~metrix~syllable~node] (l__metrix_syllable_node) {#1};
+ \begin{pgfinterruptboundingbox}
+ \draw ($(l__metrix_syllable_node.north)+(-0.15,0)
+ + (\usemetrixvar{accentxshift},\usemetrixvar{brvshift})
+ + (\tl_use:N \l__metrix_internal_itcorrection_tl,0)$)
+ arc [start~angle=0, end~angle=180, radius=-0.15];
+ \end{pgfinterruptboundingbox}
+ \end{tikzpicture}
+ }
+\NewDocumentCommand { \acct } { m }
+ {
+ \begin{tikzpicture}[baseline=(l__metrix_syllable_node.base),every~metrix~accent]
+ \node [every~metrix~syllable~node] (l__metrix_syllable_node) {#1};
+ \begin{pgfinterruptboundingbox}
+ \fill ($(l__metrix_syllable_node.south)
+ + (0,\usemetrixvar{dotshift})$)
+ circle [radius=1.25\pgflinewidth];
+ \end{pgfinterruptboundingbox}
+ \end{tikzpicture}
+ }
+\NewDocumentCommand { \bow } { m }
+ {
+ \begin{tikzpicture}[baseline=(l__metrix_syllable_node.base),every~metrix~bow]
+ \node [every~metrix~syllable~node] (l__metrix_syllable_node) {#1};
+ \draw ($(l__metrix_syllable_node.base~west)+
+ (\usemetrixvar{bowshortening},\usemetrixvar{bowshift})$)
+ to [out=-45, in=225,looseness=\usemetrixvar{bowlooseness}] ($(l__metrix_syllable_node.base~east)+
+ (-\usemetrixvar{bowshortening},\usemetrixvar{bowshift})$);
+ \end{tikzpicture}
+ }
+\ExplSyntaxOff
+\tikzset {
+ every metrix symbol/.style={
+ line width=\usemetrixvar{symbollinewidth},
+ color=\usemetrixvar{symbolcolor},
+ x=\usemetrixvar{baseunit},y=\usemetrixvar{baseunit},
+ },
+ every metrix big symbol/.style={
+ line width=\usemetrixvar{bigsymbollinewidth},
+ color=\usemetrixvar{symbolcolor},
+ x=\usemetrixvar{bigbaseunit},y=\usemetrixvar{bigbaseunit},
+ },
+ every metrix symbol node/.style={
+ inner sep=0pt, anchor=center,
+ },
+ every metrix break node/.style={
+ inner sep=0pt, anchor=base,
+ },
+ every metrix syllable node/.style={
+ inner sep=0pt, anchor=base,
+ },
+ every metrix bow/.style={
+ line width=\usemetrixvar{bowlinewidth},
+ color=\usemetrixvar{bowcolor},
+ x=\usemetrixvar{baseunit},y=\usemetrixvar{baseunit},
+ },
+ every metrix accent/.style={
+ line width=\usemetrixvar{accentlinewidth},
+ color=\usemetrixvar{accentcolor},
+ x=\usemetrixvar{baseunit},y=\usemetrixvar{baseunit},
+ },
+ bold highlight/.style={
+ every metrix symbol/.append style={line width=2\pgflinewidth},
+ every metrix syllable node/.append style={font=\bfseries},
+ every superscript node/.append style={font/.expand once=\tikz@textfont\bfseries},
+ },
+ colored highlight/.style={
+ every metrix symbol/.append style={draw=#1},
+ every metrix syllable node/.append style={text=#1},
+ every superscript node/.append style={text=#1},
+ },
+ colored highlight/.default={
+ \usemetrixvar{highlightcolor}
+ },
+ dashed highlight/.style={
+ every metrix symbol/.append style={dash pattern=on 1pt off 0.4pt},
+ },
+ filled highlight/.style={
+ every metrix symbol node/.append style={inner sep=2pt,fill=#1},
+ },
+ filled highlight/.default={
+ \usemetrixvar{fillcolor},
+ },
+ every superscript picture/.style={
+ baseline=-3ex,
+ },
+ every superscript node/.style={
+ inner sep=0pt,
+ font=\scriptsize,
+ },
+ every superscript label/.style={
+ inner xsep=0pt,
+ inner ysep=-3ex,
+ label distance=0.5pt,
+ },
+ add superscript/.style={
+ label={[every superscript label]right:{%
+ \tikz[every superscript picture]\node at (0,0) [every superscript node] {#1};%
+ }},
+ },
+ superscript/.style={
+ every metrix symbol node/.append style={
+ add superscript=#1,
+ },
+ every metrix break node/.append style={
+ add superscript=#1,
+ },
+ },
+ superscript/.value required,
+}
+\ExplSyntaxOn
+\NewDocumentEnvironment{symbolline} { }
+ {
+ \par\addvspace{\baselineskip}
+ \centering
+ }
+ {
+ \par\vspace{\baselineskip}
+ \noindent\ignorespacesafterend
+ }
+\cs_new:Npn \__metrix_print_vers_ref:n #1
+ {
+ \hspace*{\fill}\nolinebreak[1] \quad \hspace*{\fill} \mbox{\footnotesize #1}
+ }
+\NewDocumentCommand { \verseref } { m }
+ {
+ \__metrix_error_msg:n {
+ \string\verseref\space can~only~be~used~in~{metricverses}~env.
+ }
+ }
+\NewDocumentEnvironment{metricverses} { }
+ {
+ \RenewDocumentCommand { \verseref } { m }
+ {
+ \__metrix_print_vers_ref:n { ##1 }
+ }
+ \par
+ \addvspace{0.7\baselineskip}
+ \fp_compare:nT { \usemetrixvar{symbolshift} < 0.0 }
+ {
+ \vspace{\usemetrixvar{symbolshift}}
+ }
+ \addtolength{\baselineskip}{0.6\baselineskip}
+ }
+ {
+ \par
+ \addtolength{\baselineskip}{-0.6\baselineskip}
+ \vspace{\baselineskip}
+ \noindent\ignorespacesafterend
+ }
+\endinput
+%%
+%% End of file `metrix.sty'.