diff options
author | Karl Berry <karl@freefriends.org> | 2013-08-13 22:49:31 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2013-08-13 22:49:31 +0000 |
commit | 7b01a10cd6a2e1f25e7e56ae3d15a363c2bda441 (patch) | |
tree | ad7aa5d874ad942d55a0d700d756f78fe90f657b /Master/texmf-dist/source/latex/metrix | |
parent | f5ffdb9c55fd738e4fd0fb0c5f332a0faf540edc (diff) |
metrix (13aug13)
git-svn-id: svn://tug.org/texlive/trunk@31425 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/metrix')
-rw-r--r-- | Master/texmf-dist/source/latex/metrix/metrix.dtx | 2019 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/metrix/metrix.ins | 40 |
2 files changed, 2059 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/latex/metrix/metrix.dtx b/Master/texmf-dist/source/latex/metrix/metrix.dtx new file mode 100644 index 00000000000..a217a92d124 --- /dev/null +++ b/Master/texmf-dist/source/latex/metrix/metrix.dtx @@ -0,0 +1,2019 @@ +% \iffalse meta-comment +% +%% 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 +%% +%<*driver|package> +% The version of expl3 required is tested as early as possible, as +% some really old versions do not define \ProvidesExplPackage. +\RequirePackage{expl3}[2013/07/12] +%<package>\@ifpackagelater{expl3}{2013/03/14} +%<package> {} +%<package> {% +%<package> \PackageError{metrix}{Support package l3kernel too old} +%<package> {% +%<package> Please install an up to date version of l3kernel\MessageBreak +%<package> using your TeX package manager or from CTAN.\MessageBreak +%<package> \MessageBreak +%<package> Loading xparse will abort!% +%<package> }% +%<package> \endinput +%<package> } +\def\metrixFileName{metrix} +\def\metrixFileDescription{Typset prosody/metric symbols.} +\def\metrixFileDate{2013/08/12} +\def\metrixFileVersion{1.0} +%</driver|package> +%<*driver> +\documentclass[full,english]{l3doc} + +\usepackage[latin1]{inputenc} +\usepackage[T1]{fontenc} + +\usepackage{babel} + +\usepackage{xspace} +\usepackage{xparse} +\usepackage{xcolor} + \definecolor{twred}{HTML}{91031F} + +\usepackage{metrix} + +\usepackage{tabu,booktabs} +\renewcommand{\arraystretch}{1.3} +\usepackage[bottom]{footmisc} + +\usepackage{mdframed} + \newmdenv[ + backgroundcolor=black!15, + linecolor=twred, + linewidth=1.25pt, + topline=false, + rightline=false, + bottomline=false, + frametitlefont=\sffamily\bfseries, + frametitle=Example, + ]{example} + +\usepackage{microtype} +\usepackage{tgpagella} +\usepackage[scale=0.875]{tgheros} +\usepackage{ascii} + +\AtBeginDocument{ + \DeleteShortVerb{\|} + \DeleteShortVerb{\"} + \MakeShortVerb{\+} +} + +\IndexPrologue{ + \section*{Index} + \addcontentsline{toc}{section}{Index} + The italic numbers denote the pages where the + corresponding entry is described, + numbers underlined point to the definition, + all others indicate the places where it is used. +} +\GlossaryPrologue{ + \section*{Change History} + \addcontentsline{toc}{section}{Change~History} + \markboth{{Change History}}{{Change History}} + {\GlossaryParms\ttfamily\hyphenchar\font=`\-} +} +\AtBeginDocument{\renewcommand*{\glossaryname}{Change History}} + +\newcommand{\metrix}{\textcolor{twred}{\textbf{\textsf{m\u{e}trix}}}\xspace} +\newcommand{\TikZ}{Ti\emph{k}Z\xspace} +\newcommand{\Star}{\meta{\textup{\texttt{*}}}} +\newcommand{\mail}[1]{\href{mailto:#1}{#1}} + + +\begin{document} + \DocInput{\metrixFileName.dtx} +\end{document} +%</driver> +% \fi +% +% +% \title{The \metrix package} +% +% \author{Tobias Weh\thanks{URL: \url{http://www.tweh.de}, Mail: \mail{mail@tweh.de}}} +% +% \date{Version \metrixFileVersion\ -- Released \metrixFileDate} +% +% \maketitle +% +% \begin{documentation}\MakePrivateLetters +% +% \begin{abstract} +% \mbox{}\par +% \begin{center} +% \Large +% \metrics{_ _ _ _ _ | _ u u _ u u _ } +% {\acct{e}t qu\acct{o}d temp-t\acct{a}-bam | scr\acct{i}-be-re v\acct{e}r-sus \acct{e}-rat} +% \end{center} +% \par\bigskip +% The \metrix package can be used to print the prosodics/metrics of (latin) verses. +% It provides macros to typeset the symbols stand alone and in combination with syllables +% (including automatic alignment like seen above). Furthermore it defines a new br\brv{e}vis +% and a l\lng{o}nga accent^^A +% \footnote{I know that these signs are no accents in the liguistic sense, but +% they are in the \TeX\ tradition \dots} +% and \bow{a b}ow to contract syllables. +% +% \medskip +% \emph{Thanks to David Carlisle, Marco Daniel, Enrico Gregorio, Bruno Le Floch and +% Joseph Wright who helped me with starting in \LaTeX3 programming. The verse above +% is by Ovid in his Tristia~4,10,26.} +% \end{abstract} +% +% \section{Prerequisites} +% \metrix relies only on a few packages: \pkg{tikz} (including the +calc+ library), \pkg{xpatch} +% and \pkg{xparse}, which stand for the whole \LaTeX3 bundle. +% +% \section{Package loading} +% Load \metrix as usual with +\usepackage{metrix}+. At the moment it has no options. +% +% \section{Bugs and feedback} +% \subsection{Known issues} +% \begin{itemize} +% \item At the moment the escaping of hyphen chars is not that good (see section~\ref{faq:hyphen}). +% \item Unfortunatly you can't use the active quotes of \pkg{csquotes} inside of +% \cs{metrics} syllable list (see section~\ref{faq:quotes}). +% \end{itemize} +% I'm sure there are more bugs and issues let me know if you find them \dots +% \subsection{Feedback} +% Any feedback on \metrix is appreciated. You may use its GitHub repository at +% \url{https://github.com/tweh/metrix} to request features or report bugs or +% send me an e-mail (\mail{mail@tweh.de}). +% +% +% \section{Metric symbols} +% \subsection{Stand alone metric symbols} +% \begin{function}[EXP]{\metricsymbols} +% \begin{syntax} +% \cs{metricsymbols}\Star\oarg{highlighting}\Arg{symbols} +% \end{syntax} +% This macro typesets stand alone versions of the symbols, i.e. without +% syllables below (or above) of them. Use the starred version for smaller (in line) symbols +% and the normal version for bigger symbols. \meta{symbols} must be a list of +% abbreviations as listed in table~\ref{tab:symbols};\footnotemark +% the single abbreviations must be +% separated by one (or more spaces). +% \end{function} +% \footnotetext{The break symbols cannot be used above syllables, they must be used together with +% break symbols in the syllable list, only!} +% \begin{example} +% The \emph{diphilius} can be shown with this code. +% \begin{verbatim} +% \metricsymbols{_ _uu _ _uu u_ | x _ u u _ x u_} +% \end{verbatim} +% \metricsymbols{_ _uu _ _uu u_ | x _ u u _ x u_} +% \end{example} +% \subsection{Metric symbols above (or below) syllables} +% \begin{function}[EXP]{\metrics} +% \begin{syntax} +% \cs{metrics}\oarg{highlighting}\Arg{symbols}\Arg{syllables} +% \end{syntax} +% This command can be used to align the symbols above (or below) +% syllables. The first \meta{symbols} argument works as before. +% The second argument \meta{syllables} takes the hyphenated verse. +% \end{function} +% \begin{example} +% \begin{verbatim} +% \metrics{_ u u _ _ _ | _ _ u u _ _ _ } +% {flos ve-te-ris vi-ni | meis na-ri-bus ob-iec-tust} +% \end{verbatim} +% \metrics{_ u u _ _ _ | _ _ u u _ _ _ } +% {flos ve-te-ris vi-ni | meis na-ri-bus ob-iec-tust} +% \end{example} +% +% \medskip\noindent +% You may use multiple spaces to align the abbreviations above the syllables but this is not mandatory and +% does not affect the output. But mind that the number of syllables equals the number of symbols. If you +% use the \metricsymbols*{oo} symbol you may omit the hyphen between the two syllables beloning to this +% symbol. You can merge multiple words by \emph{embracing} them. +% \begin{example} +% \begin{verbatim} +% \metrics{_ u u _ _ _ _ _ } +% {mol-ta quo-{que et} bel-lo pas-sus} +% \end{verbatim} +% \metrics{_ u u _ _ _ _ _ } +% {mol-ta quo-{que et} bel-lo pas-sus} +% \end{example} +% +% The macros \cs{metrics} and \cs{metricsymbols} can also be used to typeset +% single symbols or symbol syllable combinations. +% \begin{example} +% \begin{verbatim} +% The \metricsymbols*{_uu} shows an \emph{elementum biceps}. +% \end{verbatim} +% The \metricsymbols*{_uu} shows an \emph{elementum biceps}. +% \end{example} +% \begin{table}[hbtp] +% \centering +% \begin{tabu} {l>{\itshape}lcl} +% \toprule +% \rowfont{\bfseries\sffamily} \multicolumn{2}{l}{abbreviation} & symbol & explantion \\ +% \midrule +% +e+ && \metricsymbols{e} & empty symbol \\ +% +u+ && \metricsymbols{u} & elementum breve \\ +% +_+ & (under score) & \metricsymbols{_} & elementum longum \\ +% +uu+ && \metricsymbols{uu} & double breve \\ +% +uu_+ && \metricsymbols{uu_} & elementum biceps \\ +% +_uu+ && \metricsymbols{_uu} & elementum biceps \\ +% +u_uu+ && \metricsymbols{u_uu} & elementum anceps \\ +% +x+ && \metricsymbols{x} & elementum anceps \\ +% +n+ && \metricsymbols{n} & elementum indifferens \\ +% +u_+ && \metricsymbols{u_} & elementum indifferens \\ +% +oo+ & (two lowercase o's) & \metricsymbols{oo} & aeolic base \\ +% +|+ & (pipe) & \metricsymbols{|} & break \\ +% +||+ & (two pipes) & \metricsymbols{||} & verse break \\ +% \bottomrule +% \end{tabu} +% \caption{Symbol abbreviations}\label{tab:symbols} +% \end{table} +% \subsection{Highlight certain symbols/syllabels} +% As you can see above \cs{metrics} and \cs{metricsymbols} got an optional argument taking +% some options to highlight a certain symbol/syllable. The \meta{highlighting} list must +% contain one or more comma separated pairs of \meta{numbers}+=+\meta{style}, where \meta{numbers} +% is the number of a symbol/syllable (e.g. +3+) or a list of numbers separated by plus signs +% (e.g. \verb.2+3+5.) in the list and \meta{style} is any \TikZ style (other \TikZ options may not +% work properly, so you maybe must create your own style, see section~\ref{faq:highlight}.) +% +% \medskip\noindent +% \metrix comes with several predefined highlighting styles: +% \DeleteShortVerb{\+} +% \begin{itemize} +% \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 +% \metricsymbols[2+3+5+7={bold highlight}]{u u_uu x _ | u _ n ||} +% +% \item \textbf{\texttt{colored highlight=}\meta{color}}\\[2ex] +% \metrics[2+5+9+13={colored highlight}]{_ u u _ _ _ | _ _ u u _ ||} +% {flos ve-te-ris vi-ni | meis na-ri-bus ob ||}\hfill +% \metricsymbols[2+3+5+7={colored highlight}]{u u_uu x _ | u _ n ||} +% +% This style has an \emph{optional} argument to change the highlighting color on the fly. +% To change the color in general change the value of the variable \verb.highlightcolor.. +% +% \item \textbf{\texttt{dashed highlight}}\\[2ex] +% \metrics[2+5+9+13={dashed highlight}]{_ u u _ _ _ | _ _ u u _ ||} +% {flos ve-te-ris vi-ni | meis na-ri-bus ob ||}\hfill +% \metricsymbols[2+3+5+7={dashed highlight}]{u u_uu x _ | u _ n ||} +% +% \item \textbf{\texttt{filled highlight=}\meta{color}}\\[2ex] +% \metrics[2+5+9+13={filled highlight}]{_ u u _ _ _ | _ _ u u _ ||} +% {flos ve-te-ris vi-ni | meis na-ri-bus ob ||}\hfill +% \metricsymbols[2+3+5+7={filled highlight}]{u u_uu x _ | u _ n ||} +% +% This style has an \emph{optional} argument to change the filling color on the fly. +% To change the color in general change the value of the variable \verb.fillcolor.. +% +% \item \textbf{\texttt{superscript=}\meta{text}}\\[2ex] +% \metrics[7={superscript=a},13={superscript=b}]{_ u u _ _ _ | _ _ u u _ ||} +% {flos ve-te-ris vi-ni | meis na-ri-bus ob ||}\hfill +% \metricsymbols[5={superscript=a},9={superscript=b}]{u u_uu x _ | u _ n ||} +% +% This style takes a \emph{mandatory} argument to add a superscript letter or a +% number to a symbol. It is designed to work with the break symbols, but works with others too. +% \end{itemize} +% \MakeShortVerb{\+} +% +% \medskip\noindent +% \textbf{Sytles with an agrument must be set in braces} (see the examples)\textbf{!} +% \begin{example} +% Higlight some syllables with color. +% \begin{verbatim} +% \metrics +% [ +% 2=colored highlight, +% 4={colored highlight=orange}, +% 5={colored highlight=blue}, +% 7=colored highlight, +% 11=colored highlight +% ] +% {_ u u _ _ _ | _ _ u u _ } +% {flos ve-te-ris vi-ni | meis na-ri-bus ob} +% \end{verbatim} +% \metrics +% [ +% 2=colored highlight, +% 4={colored highlight=orange}, +% 5={colored highlight=blue}, +% 7=colored highlight, +% 11=colored highlight +% ] +% {_ u u _ _ _ | _ _ u u _ } +% {flos ve-te-ris vi-ni | meis na-ri-bus ob} +% \end{example} +% \begin{example} +% The shorter version using the \verb.+. syntax. +% \begin{verbatim} +% \metrics[2+5+9=bold highlight] +% {_ u u _ _ _ | _ _ u u _ } +% {flos ve-te-ris vi-ni | meis na-ri-bus ob} +% \end{verbatim} +% \DeleteShortVerb{\+} +% \metrics[2+5+9=bold highlight] +% {_ u u _ _ _ | _ _ u u _ } +% {flos ve-te-ris vi-ni | meis na-ri-bus ob} +% \end{example} +% \begin{example} +% Mixing and combining styles is possible too. +% \begin{verbatim} +% \metricsymbols[1+4=bold highlight, 3=colored highlight] +% {u_uu x _ || u _ n ||} \\ +% \metricsymbols[2={bold highlight,colored highlight}] +% {u_uu x _ || u _ n ||} +% \end{verbatim} +% \DeleteShortVerb{\+} +% \metricsymbols[1+4=bold highlight, 3=colored highlight] +% {u_uu x _ || u _ n ||}\\ +% \metricsymbols[2={bold highlight,colored highlight}] +% {u_uu x _ || u _ n ||} +% \MakeShortVerb{\+} +% \end{example} +% \begin{example} +% Add some superscripts to the breaks. +% \begin{verbatim} +% \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}] +% {_ _uu _ _uu _ | _uu _ _uu || _ uu _ u_} +% \end{example} +% +% \section{Accents and bows} +% \begin{function}[EXP]{\brv,\lng,\acct} +% \begin{syntax} +% \cs{brv}\Arg{vowel}\qquad\cs{lng}\Arg{vowel}\qquad\cs{acct}\Arg{vowel} +% \end{syntax} +% The first commands offer an alternative to the standard accent macros +\u+ and +\=+. The difference +% is that \cs{brv} centers the accent above the vowel or diphthong and \cs{lng} stretches the bar across +% the whole vowel or diphthong. \cs{acct} adds an accent dot below a vowel or dipthtong.\footnotemark +% \end{function} +% \footnotetext{Actually you can use any vowel, diphtong, syllable or word as \meta{vowel}, +% it makes no difference as long as it is text.} +% \begin{example} +% Add accents to all vowels. +% \begin{verbatim} +% \brv{a}m\acct{\lng{i}}c\brv{u}s pr\acct{\brv{o}}f\brv{u}g\brv{u}s +% \end{verbatim} +% \brv{a}m\acct{\lng{i}}c\brv{u}s pr\acct{\brv{o}}f\brv{u}g\brv{u}s +% \end{example} +% +% \metrix also tries to do some kind of italic correction, and shifts the accents a little to the +% right when an italic or slanted font is used. +% \par\large\medskip +% \brv{u}\enskip\textit{\brv{u}}\enskip\textsl{\brv{u}}\qquad +% \brv{i}\enskip\textit{\brv{i}}\enskip\textsl{\brv{i}}\qquad +% \brv{ae}\enskip\textit{\brv{ae}}\enskip\textsl{\brv{ae}}\hfill +% {\sffamily +% \brv{u}\enskip\textit{\brv{u}}\enskip\textsl{\brv{u}}\qquad +% \brv{i}\enskip\textit{\brv{i}}\enskip\textsl{\brv{i}}\qquad +% \brv{ae}\enskip\textit{\brv{ae}}\enskip\textsl{\brv{ae}}\hfill\mbox{}} +% \par\medskip +% \lng{u}\enskip\textit{\lng{u}}\enskip\textsl{\lng{u}}\qquad +% \lng{i}\enskip\textit{\lng{i}}\enskip\textsl{\lng{i}}\qquad +% \lng{ae}\enskip\textit{\lng{ae}}\enskip\textsl{\lng{ae}}\hfill +% {\sffamily +% \lng{u}\enskip\textit{\lng{u}}\enskip\textsl{\lng{u}}\qquad +% \lng{i}\enskip\textit{\lng{i}}\enskip\textsl{\lng{i}}\qquad +% \lng{ae}\enskip\textit{\lng{ae}}\enskip\textsl{\lng{ae}}\hfill\mbox{}} +% \par\medskip +% \acct{u}\enskip\textit{\acct{u}}\enskip\textsl{\acct{u}}\qquad +% \acct{i}\enskip\textit{\acct{i}}\enskip\textsl{\acct{i}}\qquad +% \acct{ae}\enskip\textit{\acct{ae}}\enskip\textsl{\acct{ae}}\hfill +% {\sffamily +% \acct{u}\enskip\textit{\acct{u}}\enskip\textsl{\acct{u}}\qquad +% \acct{i}\enskip\textit{\acct{i}}\enskip\textsl{\acct{i}}\qquad +% \acct{ae}\enskip\textit{\acct{ae}}\enskip\textsl{\acct{ae}}\hfill\mbox{}} +% \par\normalsize +% +% \begin{function}[EXP]{\bow} +% \begin{syntax} +% \cs{bow}\Arg{syllables} +% \end{syntax} +% \cs{bow} can be used to show the contraction of two vowels or syllables. +% \end{function} +% \begin{example} +% \begin{verbatim} +% mult\bow{um i}lle or d\bow{ei}nde +% \end{verbatim} +% mult\bow{um i}lle or d\bow{ei}nde +% \end{example} +% +% \section{Environments} +% \begin{function}{symbolline} +% This environment can be used to display a line of stand alone symbols. +% \end{function} +% \begin{example} +% \begin{verbatim} +% Text text text ... +% \begin{symbolline} +% \metricsymbols{oo e _ u u _ e u _ e u _ u_} +% \end{symbolline} +% Text text text ... +% \end{verbatim} +% Text text text ... +% \begin{symbolline} +% \metricsymbols{oo e _ u u _ e u _ e u _ u_} +% \end{symbolline} +% Text text text ... +% \end{example} +% \begin{function}{metricverses} +% \begin{syntax} +% +\begin{metricverses}+\oarg{source} +% \meta{content optional \cs{verseref}\Arg{reference}} +% +\end{metricverses}+ +% \end{syntax} +% Use this environment to display a verse with metric symbols, separate +% multiple verses by a blank line. +% \end{function} +% \begin{example} +% \begin{verbatim} +% Text text text ... +% \begin{metricverses} +% \metrics{_ u u _ _ _ | _ _ u u _ _ _ } +% {flos ve-te-ris vi-ni | meis na-ri-bus ob-iec-tust} +% +% \metrics{_ u u _ u u _ | _ _ u u +% _ u u _ } +% {ei-us a-mor cu-pi-dam | {m\bow{e h}uc} pro-li-cit +% per te-ne-bras} +% \end{metricverses} +% Text text text ... +% \end{verbatim} +% Text text text ... +% \begin{metricverses} +% \metrics{_ u u _ _ _ | _ _ u u _ _ _ } +% {flos ve-te-ris vi-ni | meis na-ri-bus ob-iec-tust} +% +% \metrics{_ u u _ u u _ | _ _ u u +% _ u u _ } +% {ei-us a-mor cu-pi-dam | {m\bow{e h}uc} pro-li-cit +% per te-ne-bras} +% \end{metricverses} +% Text text text ... +% \end{example} +% \begin{function}{\verseref} +% \begin{syntax} +% \cs{verseref}\Arg{reference} +% \end{syntax} +% Inside of +{metricverses}+ you may use \cs{verseref} to print a reference. +% \end{function} +% \begin{example} +% \begin{verbatim} +% Text text text ... +% \begin{metricverses} +% \metrics{_ u u _ _ _ | _ _ u u _ _ _ } +% {flos ve-te-ris vi-ni | meis na-ri-bus ob-iec-tust} +% \verseref{Plaut. \emph{Curc.} 96f} +% +% \metrics{_ u u _ u u _ | _ _ u u +% _ u u _ } +% {ei-us a-mor cu-pi-dam | {m\bow{e h}uc} pro-li-cit +% per te-ne-bras} +% \end{metricverses} +% Text text text ... +% \end{verbatim} +% Text text text ... +% \begin{metricverses} +% \metrics{_ u u _ _ _ | _ _ u u _ _ _ } +% {flos ve-te-ris vi-ni | meis na-ri-bus ob-iec-tust} +% \verseref{Plaut. \emph{Curc.} 96f} +% +% \metrics{_ u u _ u u _ | _ _ u u _ u u _ } +% {ei-us a-mor cu-pi-dam | {m\bow{e h}uc} pro-li-cit per te-ne-bras} +% \end{metricverses} +% Text text text ... +% \end{example} +% +% \section{FAQs}\label{sec:faq} +% \subsection{How can I display the symbols below the syllables?} +% Change the variable +symbolshift+ to a negative value. +% \begin{example} +% \begin{verbatim} +% \setmetrixvar{symbolshift}{-0.6em} +% % later ... +% \metrics{_ u u _ _ _ | _ _ u u _ _ _ } +% {flos ve-te-ris vi-ni | meis na-ri-bus ob-iec-tust} +% \end{verbatim} +% \setmetrixvar{symbolshift}{-0.6em} +% \metrics{_ u u _ _ _ | _ _ u u _ _ _ } +% {flos ve-te-ris vi-ni | meis na-ri-bus ob-iec-tust} +% \end{example} +% \subsection{How can I combine two words below one symbol?} +% Use braces +{}+ in the lists to keep them processed as one element. +% \begin{example} +% \begin{verbatim} +% \metrics{u u _ | _ _ u u } +% {cu-pi-dam | {m\bow{e h}uc} pro-li-cit } +% \end{verbatim} +% \metrics{u u _ | _ _ u u } +% {cu-pi-dam | {m\bow{e h}uc} pro-li-cit } +% \end{example} +% \subsection{How can I show a hyphen character?}\label{faq:hyphen} +% To escape a hyphen +-+ put it inside braces, but you must still +% add an unbraced hypen to show \metrix where your syllables split. +% \begin{example} +% If you enclose the hyphen in braces together with a syllable, the symbol gets +% centered above both. +% \begin{verbatim} +% \metrics{_ _ } +% {vi-{-ni}} +% \end{verbatim} +% \metrics{_ _ } +% {vi-{-ni}} +% \par\smallskip\noindent +% You can enclose only the hyphen in braces and treat it as a syllable +% but then you must add an empty symbol +e+ too. +% \begin{verbatim} +% \metrics{_ e _ } +% {vi-{-}-ni} +% \end{verbatim} +% \metrics{_ e _ } +% {vi-{-}-ni} +% \end{example} +% \subsection{How can I use quotes in \cs{metrics}?}\label{faq:quotes} +% It should be possible to use all shorthands (or direct input with Unicode) etc. +% for quotation marks except the active +% quotes of \pkg{csquotes}, which won't work inside the \cs{metrics} syllable list. It +% is possible to use \pkg{csquotes} besides \metrix though. +% \begin{example} +% \begin{verbatim} +% \metrics{ _ u }{ ``si me'' } +% \metrics{ _ u }{ ``si me'' } +% \metrics{ _ u }{ \glqq si me\grqq }% with \usepackage[<lang>]{babel} +% \metrics{ _ u }{ "`si me"' }% with \usepackage[ngerman]{babel} +% \end{verbatim} +% \metrics{ _ u }{ ``si me'' }\quad +% \metrics{ _ u }{ ``si me'' }\quad +% \metrics{ _ u }{ \glqq si me\grqq }\quad +% \metrics{ _ u }{ \glqq si me\grqq } +% \end{example} +% \subsection{How can I add a superscript letter to a certain symbol?} +% Use the |superscript| highlighting style as described above. +% \subsection{How can I make subscripts instead of superscripts?} +% The easiest way is to use the +superscript+ style and change a part of +% its definition to shift the superscripts to subscript positions. +% \begin{example} +% \begin{verbatim} +% \metricsymbols[2={superscript=x}]{ u || u } \qquad vs. \qquad +% % ... +% \tikzset{ +% every superscript picture/.style={ +% baseline=1ex, +% }, +% } +% % ... +% \metricsymbols[2={superscript=x}]{ u || u } +% \end{verbatim} +% \metricsymbols[2={superscript=x}]{ u || u } \qquad vs. \qquad +% \tikzset{ +% every superscript picture/.style={ +% baseline=2ex, +% }, +% } +% \metricsymbols[2={superscript=x}]{ u || u } +% +% \medskip\noindent +% Normally the +\tikzset+ should be part of your preamble, I used it this way to +% show the differences. +% \end{example} +% \subsection{How can I highlight all symbols/syllables?} +% \textbf{Way 1}\qquad Just call your desired highlighting style before using on of the macros +% \cs{metrics} or \cs{metricsymbols}. You may enclose this in a group to not affect the other following +% sequences. Mind that the higlighting styles must be in a way changing the +every ...+ styles +% to make this way work. +% \begin{example} +% \begin{verbatim} +% {% begin group +% \tikzset{colored highlight} +% \metrics{_ u u _ _ _ } +% {flos ve-te-ris vi-ni} +% }% end group +% \end{verbatim} +% \tikzset{colored highlight} +% \metrics{_ u u _ _ _ } +% {flos ve-te-ris vi-ni} +% \end{example} +% \par\medskip\noindent +% \textbf{Way 2}\qquad Change the +every metrix ...+ styles. +% \begin{example} +% \begin{verbatim} +% {% begin group +% \tikzset{every metrix symbol/.append style={red}} +% \metrics{_ u u _ _ _ } +% {flos ve-te-ris vi-ni} +% }% end group +% \end{verbatim} +% \tikzset{every metrix symbol/.append style={red}} +% \metrics{_ u u _ _ _ } +% {flos ve-te-ris vi-ni} +% \end{example} +% Leave out the grouping (and put this to your preamble) if yout want to highlight +% the symbols in your whole document. +% \subsection{How can I change the size of a symbol?} +% Change the two base vector units. +% \begin{example} +% \begin{verbatim} +% \setmetrixvar{baseunit}{1em} +% \setmetrixvar{bigbaseunit}{1.6em} +% \end{verbatim} +% \end{example} +% If you want to change the size of a single symbol to highlight it you must +% create your own highlighting style. +% \begin{example} +% \begin{verbatim} +% \tikzset{ +% bigger highlight/.style={ +% every metrix symbol/.append style={x=2.5em,y=2.5em,line width=1.5pt}, +% }, +% } +% % later +% \metricsymbols[2=bigger highlight]{u_uu x _ || u _ n x} +% \end{verbatim} +% \tikzset{ +% bigger highlight/.style={ +% every metrix symbol/.append style={x=2.5em,y=2.5em,line width=1.5pt}, +% }, +% } +% \metricsymbols[2=bigger highlight]{u_uu x _ || u _ n x} +% \end{example} +% \subsection{How can I stop highlighting the syllables too?}\label{faq:highlight} +% \textbf{Way 1}\qquad Change the highlight styles (in your preamble). +% \begin{example} +% \begin{verbatim} +% \tikzset{ +% colored highlight/.style={ +% every metrix symbol/.append style={ +% draw=\usemetrixvar{highlightcolor}, +% }, +% }, +% } +% % later ... +% \metrics[3=colored highlight]{_ u u _ _ _ } +% {flos ve-te-ris vi-ni} +% \end{verbatim} +% {\tikzset{ +% colored highlight/.style={ +% every metrix symbol/.append style={draw=\usemetrixvar{highlightcolor}}, +% } +% } +% \metrics[3=colored highlight]{_ u u _ _ _ } +% {flos ve-te-ris vi-ni}} +% \end{example} +% \par\medskip\noindent +% \textbf{Way 2}\qquad Create your own highlighting style, which is very similar +% to way 1, as the following example shows. Every own style should change the apperance +% by appending the settings to one of the +every ...+ styles. +% \begin{example} +% \begin{verbatim} +% \tikzset{ +% my highlight/.style={ +% every metrix symbol/.append style={draw=blue,line width=0.07em}, +% } +% } +% \metrics[5=my highlight]{_ u u _ _ _ } +% {flos ve-te-ris vi-ni} +% \end{verbatim} +% \tikzset{ +% my highlight/.style={ +% every metrix symbol/.append style={draw=blue,line width=0.1em}, +% } +% } +% \metrics[5=my highlight]{_ u u _ _ _ } +% {flos ve-te-ris vi-ni} +% \end{example} +% \subsection{Why got the highlight styles that long names?} +% To prevent conflict with other packages. +% \begin{example} +% If you want to shorten it create your own style as described above or use +% \begin{verbatim} +% \tikzset{ +% hl/.style={colored highlight} +% } +% \end{verbatim} +% to map the style to a shorter name. Then you can use it like in +% \begin{verbatim} +% \metricsymbols[2=hl]{u _ _ u} +% \end{verbatim} +% \end{example} +% \subsection{How can I change the font of all syllables?} +% Extend the +every metrix syllable node+ style +% \begin{example} +% Print all syllables in italic with the following extension. +% \begin{verbatim} +% \tikzset{ +% every metrix syllable node/.append sytle={font=\itshape}, +% } +% \end{verbatim} +% \end{example} +% +% \section{Customization} +% Some hints were already given in the FAQ section (see section~\ref{sec:faq}) but here I will +% list all variables and \TikZ styles that are in use and can be changed to customize +% \metrix easily. +% \subsection{Variables} +% \begin{function}{\setmetrixvar,\usemetrixvar} +% To customize the rendering of the symbols, accents and bow \metrix has some variables +% that you can change. +% \begin{syntax} +% \cs{setmetrixvar}\Arg{variable}\Arg{value} +% \end{syntax} +% Use \cs{setmetrixvar} to change a value. The variables and the default values are listed +% in table~\ref{tab:variables}. To access a value you can use \cs{usemetrixvar}\Arg{variable}. +% \end{function} +% It is highly recommended to use font size depending units, i.e. +em+ or +ex+, for all lengthen +% to keep the symbols usable in different font sizes, for example in headlines or footnotes. +% \begin{example} +% Change the highlighting color to blue. +% \begin{verbatim} +% \setmetrixvar{higlightcolor}{blue} +% % later +% \metrics[5=colored highlight]{_ u u _ _ _ } +% {flos ve-te-ris vi-ni} +% \end{verbatim} +% \setmetrixvar{highlightcolor}{blue} +% \metrics[5=colored highlight]{_ u u _ _ _ } +% {flos ve-te-ris vi-ni} +% \end{example} +% \begin{example} +% Create your own highlighting style but use the default highlighting color. +% \begin{verbatim} +% \tikzset{ +% my highlight/.style={ +% every metrix symbol/.append style={ +% draw=\usemetrixvar{highlightcolor}, +% line width=0.15em +% }, +% }, +% } +% \metrics[5=my highlight]{_ u u _ _ _ } +% {flos ve-te-ris vi-ni} +% \end{verbatim} +% \tikzset{ +% my highlight/.style={ +% every metrix symbol/.append style={ +% draw=\usemetrixvar{highlightcolor}, +% line width=0.15em +% }, +% }, +% } +% \metrics[5=my highlight]{_ u u _ _ _ } +% {flos ve-te-ris vi-ni} +% \end{example} +% \begin{table}[p] +% \vspace*{-3\baselineskip} +% \centering +% \begin{tabu}to \textwidth {llX} +% \toprule +% \rowfont{\bfseries\sffamily} variable & default & explanation \\ +% \midrule +% +symbollinewidth+ & +0.04em+ & line width of symbols above syllables and small stand alone symbols \\ +% +bigsymbollinewidth+ & +0.06em+ & line width of big stand alone symbols \\ +% +accentlinewidth+ & +0.03em+ & line width of accents (\cs{lng} and \cs{brv}) \\ +% +bowlinewidth+ & +0.03em+ & line width of bows (\cs{bow}) \\ +% +symbolsep+ & +0.4em+ & gap between symbols in stand alone lists \\ +% +baseunit+ & +0.9em+ & length of the base vector for drawing symbols above +% syllables, small stand alone symbols, accents and bows\\ +% +bigbaseunit+ & +1.4em+ & length of the base vector for drawing stand alone symbols \\ +% +shortsyllablelimit+ & +0.8em+ & all syllables shorter than this can be treated specially, e.g. +% they'll get a shorter elementum longum. \\ +% +gap+ & +0.09em+ & small gap between lines of the symbols, e.g. the distance between the +% two lines of a verse break \\ +% +symbolshift+ & +1.1em+ & leght to shift the symbols above or below the syllables +% (try +-0.6em+ to display the symbols below the base line) \\ +% +lngshift+ & +0.8em+ & length to shift the longa accent \\ +% +lngshortening+ & +0.075em+ & length to shorten the longa accent a little \\ +% +lngminlength+ & +0.25em+ & minimum width of a longa accent \\ +% +brvshift+ & +0.9em+ & length to shift the brevis accent \\ +% +dotshift+ & +-0.15em+ & length to shift the dot accent \\ +% +itcorrection+ & +0.11em+ & length to shift the accents above italic/slanted letters \\ +% +accentxshift+ & +-0.025em+ & length to shift the accents horizontally \\ +% +bowshift+ & +-0.15em+ & length to shift the bow below the base line \\ +% +bowshortening+ & +0.15em+ & length to shrink the bow a little \\ +% +bowlooseness+ & +0.75+ & value to influence the bending of the bow \\ +% +symbolcolor+ & +black+ & color of metric symbols \\ +% +accentcolor+ & +black+ & color of accents (\cs{lng} and \cs{brv}) \\ +% +bowcolor+ & +black+ & color of bows (\cs{bow}) \\ +% +highlightcolor+ & +red+ & color of highlighted symbols and syllabels +% used in +colored highlight+ style \\ +% +fillcolor+ & +yellow+ & color of filled symbol +node+s +% used in +filled highlight+ style \\ +% +breakgap+ & +0.6em+ & gap before and after a (verse) break \\ +% +emptywidth+ & +1em+ & gap replacing an empty symbol (abbreviation +e+) \\ +% \bottomrule +% \end{tabu} +% \caption{Variables}\label{tab:variables} +% \end{table} +% +% \subsection{\TikZ styles}\label{sec:styles} +% Beside the variables you may change the \TikZ styles used by \metrix. But please mind +% that all styles are not empty by default so you should prefer +/.append style+ against +% +/.style+. Otherwise it may cause strange effects. Remind that you can use \cs{usemetrixvar} +% to access a variable. +% \begin{variable}{every~metrix~symbol, every~metrix~big~symbol, every~metrix~symbol~node} +% These three styles define the apperance of the metric symbols. They define the line width, +% the color, the basis vectors and other things. +% \end{variable} +% \begin{variable}{every~metrix~syllable~node,every~metrix~break~node} +% These styles defines the +node+s in which a syllable or a break symbol (the ones spanning across +% the symbol and the syllable line) is typeset, e.g. it aligns these +node+s at their base line. +% \end{variable} +% \begin{variable}{every~metrix~accent} +% This style defines the apperance of accents created by \cs{lng} and \cs{brv}. +% \end{variable} +% \begin{variable}{every~metrix~bow} +% This style defines the apperance of bows below symbols. +% \end{variable} +% \begin{variable}{bold~highlight,colored~highlight,dashed~highlight,filled~highlight,superscript} +% These styles can be used to highlight a certain symbol. +% \end{variable} +% \begin{variable}{every~superscript~picture,every~superscript~node,every~superscript~label} +% These styles are used to define the +superscript+ highlighting style. +% \end{variable} +% +% \end{documentation} +% +% \begin{implementation} +% +% \section{Implementation} +% +% \begin{macrocode} +%<*package> +% \end{macrocode} +% +% \begin{macrocode} +%<@@=metrix> +% \end{macrocode} +% +% \begin{macrocode} +\ProvidesExplPackage + {\metrixFileName}{\metrixFileDate}{\metrixFileVersion}{\metrixFileDescription} +% \end{macrocode} +% +% \subsection{Required packages} +% \begin{macrocode} +\RequirePackage{xparse} +\RequirePackage{xpatch} +\RequirePackage{tikz} +\ExplSyntaxOff + \usetikzlibrary{calc} +\ExplSyntaxOn +% \end{macrocode} +% +% \subsection{Variables} +% All variables are internal. The user can change them via \cs{setmetrixvar} and use them +% via \cs{usemetrixvar}. +% \begin{variable}[internal]{\g_@@_variable_symbollinewidth_tl} +% This variable stores the line width for all metric symbols above (or below) syllables. +% \begin{macrocode} +\tl_new:N \g_@@_variable_symbollinewidth_tl +\tl_set:Nn \g_@@_variable_symbollinewidth_tl { 0.04em } +% \end{macrocode} +% \end{variable} +% \begin{variable}[internal]{\g_@@_variable_bigsymbollinewidth_tl} +% This variable stores the line width for all stand alone metric symbols. +% \begin{macrocode} +\tl_new:N \g_@@_variable_bigsymbollinewidth_tl +\tl_set:Nn \g_@@_variable_bigsymbollinewidth_tl { 0.06em } +% \end{macrocode} +% \end{variable} +% \begin{variable}[internal]{\g_@@_variable_accentlinewidth_tl} +% This variable stores the line width of the accent like symbols. +% \begin{macrocode} +\tl_new:N \g_@@_variable_accentlinewidth_tl +\tl_set:Nn \g_@@_variable_accentlinewidth_tl { 0.04em } +% \end{macrocode} +% \end{variable} +% \begin{variable}[internal]{\g_@@_variable_bowlinewidth_tl} +% This variable stores the line width of the bow. +% \begin{macrocode} +\tl_new:N \g_@@_variable_bowlinewidth_tl +\tl_set:Nn \g_@@_variable_bowlinewidth_tl { 0.04em } +% \end{macrocode} +% \end{variable} +% \begin{variable}[internal]{\g_@@_variable_symbolsep_tl} +% This variable stores the gap between two or more stand alone metric symbols. +% \begin{macrocode} +\tl_new:N \g_@@_variable_symbolsep_tl +\tl_set:Nn \g_@@_variable_symbolsep_tl { 0.4em } +% \end{macrocode} +% \end{variable} +% \begin{variable}[internal]{\g_@@_variable_baseunit_tl} +% This variable stores the length of the basis vector for all metric symbols above (or below) +% syllables and accent like symbols. +% \begin{macrocode} +\tl_new:N \g_@@_variable_baseunit_tl +\tl_set:Nn \g_@@_variable_baseunit_tl { 0.9em } +% \end{macrocode} +% \end{variable} +% \begin{variable}[internal]{\g_@@_variable_bigbaseunit_tl} +% This variable stores the length of the basis vector for all stand alone metric symbols. +% \begin{macrocode} +\tl_new:N \g_@@_variable_bigbaseunit_tl +\tl_set:Nn \g_@@_variable_bigbaseunit_tl { 1.4em } +% \end{macrocode} +% \end{variable} +% \begin{variable}[internal]{\g_@@_variable_gap_tl} +% Length for small gaps in the symbols, e.g. the gap between the two bows of an elementum biceps. +% \begin{macrocode} +\tl_new:N \g_@@_variable_gap_tl +\tl_set:Nn \g_@@_variable_gap_tl { 0.09em } +% \end{macrocode} +% \end{variable} +% \begin{variable}[internal]{\g_@@_variable_symbolshift_tl} +% This variable stores the value to shift metric symbols above (or below) syllables. +% Set this variable to approx +1.1em+ to draw the symbols above the syllable and to +-0.6em+ +% to draw them below. +% \begin{macrocode} +\tl_new:N \g_@@_variable_symbolshift_tl +\tl_set:Nn \g_@@_variable_symbolshift_tl { 1.1em } +% \end{macrocode} +% \end{variable} +% \begin{variable}[internal]{\g_@@_variable_lngshift_tl} +% This variable stores the value to shift the longa accent. +% \begin{macrocode} +\tl_new:N \g_@@_variable_lngshift_tl +\tl_set:Nn \g_@@_variable_lngshift_tl { 0.15em } +% \end{macrocode} +% \end{variable} +% \begin{variable}[internal]{\g_@@_variable_lngshortening_tl} +% This variable stores the value to shorten the longa accent. +% \begin{macrocode} +\tl_new:N \g_@@_variable_lngshortening_tl +\tl_set:Nn \g_@@_variable_lngshortening_tl { 0.075em } +% \end{macrocode} +% \end{variable} +% \begin{variable}[internal]{\g_@@_variable_lngminlength_tl} +% This variable stores the value to shorten the longa accent. +% \begin{macrocode} +\tl_new:N \g_@@_variable_lngminlength_tl +\tl_set:Nn \g_@@_variable_lngminlength_tl { 0.25em } +% \end{macrocode} +% \end{variable} +% \begin{variable}[internal]{\g_@@_variable_brvshift_tl} +% This variable stores the value to shift the brevis accent. +% \begin{macrocode} +\tl_new:N \g_@@_variable_brvshift_tl +\tl_set:Nn \g_@@_variable_brvshift_tl { 0.25em } +% \end{macrocode} +% \end{variable} +% \begin{variable}[internal]{\g_@@_variable_dotshift_tl} +% This variable stores the value to shift the brevis accent. +% \begin{macrocode} +\tl_new:N \g_@@_variable_dotshift_tl +\tl_set:Nn \g_@@_variable_dotshift_tl { -0.15em } +% \end{macrocode} +% \end{variable} +% \begin{variable}[internal]{ +% \g_@@_variable_itcorrection_tl, +% \l_@@_internal_itcorrection_tl, +% \g_@@_internal_itcorrection_zero_tl} +% These variables are used to set the italic correction of accents. +% \begin{macrocode} +\tl_new:N \g_@@_variable_itcorrection_tl +\tl_set:Nn \g_@@_variable_itcorrection_tl { 0.11em } +\tl_new:N \l_@@_internal_itcorrection_tl +\tl_set:Nn \l_@@_internal_itcorrection_tl { 0em } +\tl_new:N \g_@@_internal_itcorrection_zero_tl +\tl_set:Nn \g_@@_internal_itcorrection_zero_tl { 0em } +% \end{macrocode} +% \end{variable} +% \begin{variable}[internal]{\g_@@_variable_accentxshift_tl} +% This variable ise used to shift the accents horizontally. +% \begin{macrocode} +\tl_new:N \g_@@_variable_accentxshift_tl +\tl_set:Nn \g_@@_variable_accentxshift_tl { -0.025em } +% \end{macrocode} +% \end{variable} +% \begin{variable}[internal]{\g_@@_variable_bowshift_tl} +% This variable stores the value to shift the bow. +% \begin{macrocode} +\tl_new:N \g_@@_variable_bowshift_tl +\tl_set:Nn \g_@@_variable_bowshift_tl { -0.15em } +% \end{macrocode} +% \end{variable} +% \begin{variable}[internal]{\g_@@_variable_bowshortening_tl} +% This variable stores the value to shrink the bow. +% \begin{macrocode} +\tl_new:N \g_@@_variable_bowshortening_tl +\tl_set:Nn \g_@@_variable_bowshortening_tl { 0.15em } +% \end{macrocode} +% \end{variable} +% \begin{variable}[internal]{\g_@@_variable_bowlooseness_tl} +% This variable stores the value to shrink the bow. +% \begin{macrocode} +\tl_new:N \g_@@_variable_bowlooseness_tl +\tl_set:Nn \g_@@_variable_bowlooseness_tl { 0.75 } +% \end{macrocode} +% \end{variable} +% \begin{variable}[internal] +% {\g_@@_variable_symbolcolor_tl,\g_@@_variable_accentcolor_tl,g_@@_variable_bowcolor_tl} +% These variables store the color of symbols, accents and bows. +% \begin{macrocode} +\tl_new:N \g_@@_variable_symbolcolor_tl +\tl_set:Nn \g_@@_variable_symbolcolor_tl { black } +\tl_new:N \g_@@_variable_accentcolor_tl +\tl_set:Nn \g_@@_variable_accentcolor_tl { black } +\tl_new:N \g_@@_variable_bowcolor_tl +\tl_set:Nn \g_@@_variable_bowcolor_tl { black } +% \end{macrocode} +% \end{variable} +% \begin{variable}[internal] +% {\g_@@_variable_highlightcolor_tl} +% These variable stores the color used in the +colored highlight+ style. +% \begin{macrocode} +\tl_new:N \g_@@_variable_highlightcolor_tl +\tl_set:Nn \g_@@_variable_highlightcolor_tl { red } +% \end{macrocode} +% \end{variable} +% \begin{variable}[internal] +% {\g_@@_variable_fillcolor_tl} +% These variable stores the color used in the +filled highlight+ style. +% \begin{macrocode} +\tl_new:N \g_@@_variable_fillcolor_tl +\tl_set:Nn \g_@@_variable_fillcolor_tl { yellow } +% \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} +\tl_new:N \g_@@_variable_breakgap_tl +\tl_set:Nn \g_@@_variable_breakgap_tl { 0.6em } +% \end{macrocode} +% \end{variable} +% \begin{variable}[internal]{\g_@@_variable_emptywidth_tl} +% This variable stores the width of the gap caused by an empty symbol (abbreviation +e+). +% \begin{macrocode} +\tl_new:N \g_@@_variable_emptywidth_tl +\tl_set:Nn \g_@@_variable_emptywidth_tl { 1em } +% \end{macrocode} +% \end{variable} +% \begin{variable}[internal]{\l_@@_words_tl} +% This list stores the words of the \cs{metrics} macro. +% \begin{macrocode} +\tl_new:N \l_@@_words_tl +% \end{macrocode} +% \end{variable} +% \begin{variable}[internal]{\l_@@_syllables_seq} +% This list stores the words of the \cs{l_@@_words_tl} list. +% \begin{macrocode} +\seq_new:N \l_@@_syllables_seq +% \end{macrocode} +% \end{variable} +% \begin{variable}[internal]{\l_@@_symbols_seq} +% This list stores the metric symbols of \cs{metrics} and \cs{metricsymbols}. +% \begin{macrocode} +\seq_new:N \l_@@_symbols_seq +% \end{macrocode} +% \end{variable} +% \begin{variable}[internal]{\l_@@_highlights_prop} +% This list stores the higlighting styles of \cs{metrics} and \cs{metricsymbols}. +% \begin{macrocode} +\prop_new:N \l_@@_highlights_prop +% \end{macrocode} +% \end{variable} +% \begin{variable}[internal]{\l_@@_highlight_seq,\l_@@_highlight_pos_seq} +% This lists are used to evaluate a higlight style. +% \begin{macrocode} +\seq_new:N \l_@@_highlight_seq +\seq_new:N \l_@@_highlight_pos_seq +% \end{macrocode} +% \end{variable} +% \begin{variable}[internal]{\q_@@_space_marker} +% This is the marker for spaces inside of the \cs{l_@@_words_tl} list. +% \begin{macrocode} +\quark_new:N \q_@@_space_marker +% \end{macrocode} +% \end{variable} +% \begin{variable}[internal]{\l_@@_process_int} +% This process counter is used to combine the symbols and syllables. +% \begin{macrocode} +\int_new:N \l_@@_process_int +% \end{macrocode} +% \end{variable} +% \begin{variable}[internal]{\l_@@_short_syllable_bool,\l_@@_syllable_box,\g_@@_variable_shortsyllablelimit_tl} +% This boolean can be used to store that a syllable is short, e.g. \emph{li} will be defined +% as short wheras \emph{man} is long. That will be used to shorten the |_| symbol. Furthermore +% we'll need a box to measure the length of a syllable and a variable to save the limit for +% short syllables. +% \begin{macrocode} +\bool_new:N \l_@@_short_syllable_bool +\box_new:N \l_@@_syllable_box +\tl_new:N \g_@@_variable_shortsyllablelimit_tl +\tl_set:Nn \g_@@_variable_shortsyllablelimit_tl { 0.8em } +% \end{macrocode} +% \end{variable} +% +% \subsection{Variants} +% Later we'll need the following variant. +% \begin{macrocode} +\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 } +% \end{macrocode} +% +% \subsection{Internal main macros} +% \begin{macro}[internal]{\@@_metrics:nn} +% 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 +% was \url{http://tex.stackexchange.com/q/124698/4918}. David Carlisle and Bruno Le Floch +% lead me to the implementation of the highlighting mechanism, see +% \url{http://tex.stackexchange.com/q/124782/4918}} +% \begin{macrocode} +\cs_new_protected:Npn \@@_metrics:nn #1 #2 + { + \tl_set:Nx \l_@@_words_tl { \tl_trim_spaces:n { #2 } } +% \end{macrocode} +% First replace the spaces by a special marker \cs{q_@@_space_marker} and add +% hyphens: a space becomes a syllable. +% \begin{macrocode} + \tl_replace_all:Nnn \l_@@_words_tl { ~ } { - \q_@@_space_marker - } +% \end{macrocode} +% Then split the word list at hypens. +% \begin{macrocode} + \seq_set_split:NnV \l_@@_syllables_seq { - } \l_@@_words_tl +% \end{macrocode} +% Split the symbol list at spaces +% \begin{macrocode} + \seq_set_split:Nnx \l_@@_symbols_seq { ~ } { \tl_trim_spaces:n { #1 } } +% \end{macrocode} +% Test whether both lists got the same length: +% \begin{macrocode} + \int_zero:N \l_@@_process_int + \seq_map_inline:Nn \l_@@_syllables_seq + { + \tl_if_eq:nnT { ##1 } { \q_@@_space_marker } + { \int_incr:N \l_@@_process_int } + } + \int_compare:nTF + { + \seq_count:N \l_@@_syllables_seq - + \seq_count:N \l_@@_symbols_seq = \l_@@_process_int + } + { +% \end{macrocode} +% continue with list processing, if the numbers are equal: +% \begin{macrocode} + \int_zero:N \l_@@_process_int + \seq_map_inline:Nn \l_@@_syllables_seq + { + \int_incr:N \l_@@_process_int + \tl_if_eq:nnTF { ##1 } { \q_@@_space_marker } + { +% \end{macrocode} +% If the syllable is a space the process counter must be decremented and +% a space is typeset. +% \begin{macrocode} + \int_add:Nn \l_@@_process_int { -1 } + \c_space_token + } + { +% \end{macrocode} +% Finally typeset the syllable and it's symbol. +% \begin{macrocode} + \str_case:nnn { ##1 } + { + { | } + { + \@@_break_node:n { \@@_l_break: } + } + { || } + { + \@@_break_node:n { \@@_ll_break: } + } + } + { + \@@_print_syllable:n { ##1 } + } + } + } + } +% \end{macrocode} +% send an error, else. +% \begin{macrocode} + { + \@@_error_msg:n + { + Numbers~of~symbols~(\seq_count:N \l_@@_symbols_seq)~and~syllables~ + (\int_eval:n + { + \seq_count:N \l_@@_syllables_seq - \l_@@_process_int + } + )~mismatch. + } + } + } +% \end{macrocode} +% \end{macro} +% \begin{macro}[internal]{\@@_metricsymbols:n} +% This macro works like \cs{\@@_metrics} but is used to print stand alone metric +% symbols via \cs{metricsymbols}. +% \begin{macrocode} +\cs_new_protected:Npn \@@_metricsymbols:n #1 + { + \seq_set_split:Nnx \l_@@_symbols_seq { ~ } { \tl_trim_spaces:n { #1 } } + \int_zero:N \l_@@_process_int + \seq_map_inline:Nn \l_@@_symbols_seq + { + \int_incr:N \l_@@_process_int + \int_compare:nT { \l_@@_process_int > 1 } + { + \hspace{\usemetrixvar{symbolsep}} + } + \str_case:nnn { ##1 } + { + { | } + { + \@@_break_gap: + \@@_align_symbol:n { \@@_l_bigmark: } + \@@_break_gap: + } + { || } + { + \@@_break_gap: + \@@_align_symbol:n { \@@_ll_bigmark: } + \@@_break_gap: + } + } + { + \@@_align_symbol:n { \@@_print_symbol: } + } + } + } +% \end{macrocode} +% \end{macro} +% \begin{macro}[internal]{\@@_print_syllable:n} +% This macro combines a single syllable and the corrosponding metric symbol +% taken frome the symbol list index with the process counter. +% \begin{macrocode} +\cs_new_protected:Npn \@@_print_syllable:n #1 + { + \group_begin: +% \end{macrocode} +% Check wether the current syllable is short or long and set the corresponding bbol. +% \begin{macrocode} + \hbox_set:Nn \l_@@_syllable_box { #1 } + \dim_compare:nTF { \box_wd:N \l_@@_syllable_box < \g_@@_variable_shortsyllablelimit_tl } + { \bool_set_true:N \l_@@_short_syllable_bool } + { \bool_set_false:N \l_@@_short_syllable_bool } +% \end{macrocode} +% Set up the currend highlight is it is definded +% \begin{macrocode} + \cs_set:Npx \@@_current_highlight: { + \prop_get:NV \l_@@_highlights_prop \l_@@_process_int + } + \expandafter\tikzset\expandafter{\@@_current_highlight:} +% \end{macrocode} +% Finally print the syllable and the symbol above. Use +{pgfinterruptboundingbox}+ +% so that the symbol doesn't takes space ad doesn't cause gaps between the syllables. +% \begin{macrocode} + \begin{tikzpicture} + [ + baseline=(l_@@_syllable_node.base), + ] + \node [every~metrix~syllable~node] (l_@@_syllable_node) {#1}; + \begin{pgfinterruptboundingbox} + \node [every~metrix~symbol~node] + at ($(l_@@_syllable_node.base)+(0,\usemetrixvar{symbolshift}) + +(\tl_use:N \l_@@_internal_itcorrection_tl,0)$) + { \@@_print_symbol: }; + \end{pgfinterruptboundingbox} + \end{tikzpicture} + \group_end: + } +% \end{macrocode} +% \end{macro} +% \begin{macro}[internal]{\@@_print_symbol:} +% This command selects the right symbol by it's abbreviation. +% \begin{macrocode} +\cs_new_protected:Npn \@@_print_symbol: + { + \cs_if_exist_use:cF + { + @@_\seq_item:Nn \l_@@_symbols_seq + { \l_@@_process_int }_mark: + } + { + \@@_error_msg:n + { + Unknown~symbol~abbreviation~'\seq_item:Nn + \l_@@_symbols_seq { \l_@@_process_int }'. + } + } + } +% \end{macrocode} +% \end{macro} +% +% \subsection{Internal auxiliary macros} +% +% \begin{macro}[internal]{\@@_error_msg:n} +% An abbreviation to throw an error message. +% \begin{macrocode} +\cs_new_protected:Npn \@@_error_msg:n #1 + { + \PackageError{ \metrixFileName } { #1 } + { + Please take a look at the manual or send an email. + } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[internal]{\@@_warning_msg:n} +% An abbreviation to throw an error message. +% \begin{macrocode} +\cs_new_protected:Npn \@@_warning_msg:n #1 + { + \PackageWarning{ \metrixFileName } { #1 } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[internal]{\@@_align_symbol:n} +% This macro alings the metric symbols in a stand alone list. +% \begin{macrocode} +\cs_new_protected:Npn \@@_align_symbol:n #1 + { + \group_begin: + \cs_set:Npx \@@_current_highlight: { + \prop_get:NV \l_@@_highlights_prop \l_@@_process_int + } + \expandafter\tikzset\expandafter{\@@_current_highlight:} + \begin{tikzpicture} + [ + baseline={(0,-0.25*\usemetrixvar{baseunit})}, + ] + \node [every~metrix~symbol~node] {#1}; + \end{tikzpicture} + \group_end: + } +% \end{macrocode} +% \end{macro} +% \begin{macro}[internal]{\@@_break_gap:} +% This macro typsets the gap around the two break symbols. +% \begin{macrocode} +\cs_new_protected:Npn \@@_break_gap: + { + \hspace{\usemetrixvar{breakgap}} + } +% \end{macrocode} +% \end{macro} +% \begin{macro}[internal]{\@@_break_node:n} +% This macro typsets the gap around the two break symbols. +% \begin{macrocode} + +\cs_new:Npn \@@_break_node:n #1 + { + \group_begin: + \cs_set:Npx \@@_current_highlight: { + \prop_get:NV \l_@@_highlights_prop \l_@@_process_int + } + \expandafter\tikzset\expandafter{\@@_current_highlight:} + \tikz[baseline=(l_@@_break_node.base)] + \node (l_@@_break_node) [every~metrix~break~node] { #1 } + ; + \group_end: + } + + + +% \end{macrocode} +% \end{macro} +% \begin{macro}[internal]{\@@_e_gap:} +% This macro typsets the gap around the two break symbols. +% \begin{macrocode} +\cs_new_protected:Npn \@@_e_gap: + { + \hspace*{\usemetrixvar{emptywidth}} + } +% \end{macrocode} +% \end{macro} +% \begin{macro}[internal]{\@@_evaluate_higlights:N} +% This macro typsets the gap around the two break symbols. +% \begin{macrocode} +\cs_new_protected:Npn \@@_evaluate_higlights:n #1 + { +% \end{macrocode} +% Start with clearing the property list, otherwise the highlights from +% the last time will survive. +% \begin{macrocode} + \prop_clear:N \l_@@_highlights_prop +% \end{macrocode} +% Then spilt and process the argument as a comma separated list. +% \begin{macrocode} + \clist_map_inline:nn { #1 } + { +% \end{macrocode} +% The result is a sequence of key value pairs that we store in +% \cs{l_@@_highlight_seq}. The first part of this sequence must +% be split again at the plus sign---store it in \cs{l_@@_highlight_pos_seq}. +% \begin{macrocode} + \seq_set_split:Nnn \l_@@_highlight_seq { = } { ##1 } + \seq_set_split:Nnf \l_@@_highlight_pos_seq { + } + { + \seq_item:Nn \l_@@_highlight_seq { 1 } + } +% \end{macrocode} +% Process the \cs{l_@@_highlight_pos_seq} list and set up the property list: +% \begin{macrocode} + \seq_map_inline:Nn \l_@@_highlight_pos_seq + { + \prop_put:Nnx \l_@@_highlights_prop +% \end{macrocode} +% The key is the current item of \cs{l_@@_highlight_pos_seq}. +% \begin{macrocode} + { + ####1 + } + { +% \end{macrocode} +% The value is the second item of \cs{l_@@_highlight_seq}. +% \begin{macrocode} + \seq_item:Nn \l_@@_highlight_seq { 2 } + } + } + } + } +% \end{macrocode} +% \end{macro} +% +% \subsection{Patching font macros} +% To apply the italic correction of the accents we need to patch the font switches. +% \begin{macrocode} +\xpretocmd { \itshape } + { + \tl_set_eq:NN + \l_@@_internal_itcorrection_tl + \g_@@_variable_itcorrection_tl + } + { } + { + \@@_warning_msg:n { Could~not~patch~\string\itshape. } + } +\xpretocmd { \slshape } + { + \tl_set_eq:NN + \l_@@_internal_itcorrection_tl + \g_@@_variable_itcorrection_tl + } + { } + { + \@@_warning_msg:n { Could~not~patch~\string\slshape. } + } +\xpretocmd { \upshape } + { + \tl_set_eq:NN + \l_@@_internal_itcorrection_tl + \g_@@_internal_itcorrection_zero_tl + } + { } + { + \@@_warning_msg:n { Could~not~patch~\string\upshape. } + } +\xpretocmd { \normalfont } + { + \tl_set_eq:NN + \l_@@_internal_itcorrection_tl + \g_@@_internal_itcorrection_zero_tl + } + { } + { + \@@_warning_msg:n { Could~not~patch~\string\normalfont. } + } +% \end{macrocode} +% +% \subsection{Internal macros for metric symbols} +% +% \begin{macro}[internal]{\@@_e_mark:} +% The empty symbol. +% \begin{macrocode} +\cs_new:Npn \@@_e_mark: { \@@_e_gap: } +% \end{macrocode} +% \end{macro} +% \begin{macro}[internal]{\@@_u_mark:} +% The brevis symbol \metricsymbols*{u}. +% \begin{macrocode} +\cs_new:Npn \@@_u_mark: + { + \begin{tikzpicture}[every~metrix~symbol] + \draw (0,0) arc [start~angle=0, end~angle=180, radius=-0.225]; + \end{tikzpicture} + } +% \end{macrocode} +% \end{macro} +% \begin{macro}[internal]{\@@___mark:} +% The longa symbol \MakePrivateLetters\metricsymbols*{_}. +% \begin{macrocode} +\cs_new:Npn \@@___mark: + { + \bool_if:NTF \l_@@_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} + } + } +% \end{macrocode} +% \end{macro} +% \begin{macro}[internal]{\@@_uu_mark:} +% The biceps symbol \MakePrivateLetters\metricsymbols*{uu_}. +% \begin{macrocode} +\cs_new:Npn \@@_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} + } +% \end{macrocode} +% \end{macro} +% \begin{macro}[internal]{\@@_uu__mark:} +% The biceps symbol \MakePrivateLetters\metricsymbols*{uu_}. +% \begin{macrocode} +\cs_new:Npn \@@_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} + } +% \end{macrocode} +% \end{macro} +% \begin{macro}[internal]{\@@__uu_mark:} +% Another biceps symbol \MakePrivateLetters\metricsymbols*{_uu}. +% \begin{macrocode} +\cs_new:Npn \@@__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} + } +% \end{macrocode} +% \end{macro} +% \begin{macro}[internal]{\@@_u_uu_mark:} +% An another biceps symbol \MakePrivateLetters\metricsymbols*{u_uu}. +% \begin{macrocode} +\cs_new:Npn \@@_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} + } +% \end{macrocode} +% \end{macro} +% \begin{macro}[internal]{\@@_x_mark:} +% The anceps symbol \metricsymbols*{x}. +% \begin{macrocode} +\cs_new:Npn \@@_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} + } +% \end{macrocode} +% \end{macro} +% \begin{macro}[internal]{\@@_oo_mark:} +% The aeolic symbol \metricsymbols*{oo}. +% \begin{macrocode} +\cs_new:Npn \@@_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} + } +% \end{macrocode} +% \end{macro} +% \begin{macro}[internal]{\@@_u__mark:} +% The indifferent symbol \MakePrivateLetters\metricsymbols*{u_}. +% \begin{macrocode} +\cs_new:Npn \@@_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} + } +% \end{macrocode} +% \end{macro} +% \begin{macro}[internal]{\@@_n_mark:} +% An alternative indifferent symbol \metricsymbols*{n}. +% \begin{macrocode} +\cs_new:Npn \@@_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} + } +% \end{macrocode} +% \end{macro} +% \begin{macro}[internal]{\@@_l_mark:} +% The simple break symbol \metricsymbols*{|} (above syllables). +% \begin{macrocode} +\cs_new:Npn \@@_l_mark: + { + \begin{tikzpicture}[every~metrix~symbol] + \draw (0,0) -- (0,0.5); + \end{tikzpicture} + } +% \end{macrocode} +% \end{macro} +% \begin{macro}[internal]{\@@_ll_mark:} +% The verse break symbol \metricsymbols*{||} (above syllables). +% \begin{macrocode} +\cs_new:Npn \@@_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} + } +% \end{macrocode} +% \end{macro} +% \begin{macro}[internal]{\@@_l_bigmark:} +% The simple break symbol \metricsymbols*{|} (stand alone version). +% \begin{macrocode} +\cs_new:Npn \@@_l_bigmark: + { + \begin{tikzpicture}[every~metrix~symbol] + \draw (0,0) -- (0,0.8); + \end{tikzpicture} + } +% \end{macrocode} +% \end{macro} +% \begin{macro}[internal]{\@@_ll_bigmark:} +% The verse break symbol \metricsymbols*{||} (stand alone version). +% \begin{macrocode} +\cs_new:Npn \@@_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} + } +% \end{macrocode} +% \end{macro} +% \begin{macro}[internal]{\@@_l_break} +% The simple break symbol \metricsymbols*{|} (between syllables with symbols). +% \begin{macrocode} +\cs_new:Npn \@@_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} + } +% \end{macrocode} +% \end{macro} +% \begin{macro}[internal]{\@@_ll_break} +% The verse break symbol \metricsymbols*{||} (between syllables with symbols). +% \begin{macrocode} +\cs_new:Npn \@@_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} + } +% \end{macrocode} +% \end{macro} +% +% \subsection{User level macros} +% +% \begin{macro}{\setmetrixvar} +% This macro saves the value to an internal variable. +% \begin{macrocode} +\NewDocumentCommand{ \setmetrixvar }{ m m } + { + \tl_if_exist:cTF { g_@@_variable_#1_tl } { + \tl_set:cn { g_@@_variable_#1_tl } { #2 } + } + { + \@@_error_msg:n { Unknown~variable~'#1'. } + } + } +% \end{macrocode} +% \end{macro} +% \begin{macro}{\usemetrixvar} +% With this command one can access the value of an internal variable.\footnote{Marco Daniel +% showed me this hint at \url{http://tex.stackexchange.com/q/124600/4918}.} +% \begin{macrocode} +\DeclareExpandableDocumentCommand{ \usemetrixvar }{ m } + { + \tl_if_exist:cTF { g_@@_variable_#1_tl } { + \tl_use:c { g_@@_variable_#1_tl } + } + { + \@@_error_msg:n { Unknown~variable~'#1'. } + } + } +% \end{macrocode} +% \end{macro} +% \begin{macro}{\metrics} +% This user macro calls \cs{\@@_metrics} to typset syllables with symbols. +% \begin{macrocode} +\NewDocumentCommand { \metrics } { O{} m m } + { + \@@_evaluate_higlights:n { #1 } + \@@_metrics:nn { #2 } { #3 } + } +% \end{macrocode} +% \end{macro} +% \begin{macro}{\metricsymbols} +% This command typesets stand alone symbols. The starred version prints smaller versions. +% \begin{macrocode} +\NewDocumentCommand { \metricsymbols } { s O{} m } + { + \group_begin: + \IfBooleanF { #1 } { \tikzset{every~metrix~symbol/.style={every~metrix~big~symbol}} } + \@@_evaluate_higlights:n { #2 } + \@@_metricsymbols:n { #3 } + \group_end: + } +% \end{macrocode} +% \end{macro} +% \begin{macro}{\lng} +% This macro prints the longa accent above it's argument. +% \begin{macrocode} +\NewDocumentCommand { \lng } { m } + { + \begin{tikzpicture}[baseline=(l_@@_syllable_node.base),every~metrix~accent] + \node [every~metrix~syllable~node] (l_@@_syllable_node) {#1}; + \begin{pgfinterruptboundingbox} + \draw + ($(l_@@_syllable_node.north) + - (\usemetrixvar{lngminlength}/2,0) + +(\usemetrixvar{accentxshift},\usemetrixvar{lngshift}) + + (\tl_use:N \l_@@_internal_itcorrection_tl,0)$) + -- + ($(l_@@_syllable_node.north) + + (\usemetrixvar{lngminlength}/2,0) + +(\usemetrixvar{accentxshift},\usemetrixvar{lngshift}) + + (\tl_use:N \l_@@_internal_itcorrection_tl,0)$) + + ($(l_@@_syllable_node.north~west) + +(\usemetrixvar{lngshortening}+\usemetrixvar{accentxshift},\usemetrixvar{lngshift}) + + (\tl_use:N \l_@@_internal_itcorrection_tl,0)$) + -- + ($(l_@@_syllable_node.north~east) + +(-\usemetrixvar{lngshortening}+\usemetrixvar{accentxshift},\usemetrixvar{lngshift}) + + (\tl_use:N \l_@@_internal_itcorrection_tl,0)$) + ; + \end{pgfinterruptboundingbox} + \end{tikzpicture}% + } +% \end{macrocode} +% \end{macro} +% \begin{macro}{\brv} +% This macro prints the brevis accent above it's argument. +% \begin{macrocode} +\NewDocumentCommand { \brv } { m } + { + \begin{tikzpicture}[baseline=(l_@@_syllable_node.base),every~metrix~accent] + \node [every~metrix~syllable~node] (l_@@_syllable_node) {#1}; + \begin{pgfinterruptboundingbox} + \draw ($(l_@@_syllable_node.north)+(-0.15,0) + + (\usemetrixvar{accentxshift},\usemetrixvar{brvshift}) + + (\tl_use:N \l_@@_internal_itcorrection_tl,0)$) + arc [start~angle=0, end~angle=180, radius=-0.15]; + \end{pgfinterruptboundingbox} + \end{tikzpicture} + } +% \end{macrocode} +% \end{macro} +% \begin{macro}{\brv} +% This macro prints the dot accent below it's argument. +% \begin{macrocode} +\NewDocumentCommand { \acct } { m } + { + \begin{tikzpicture}[baseline=(l_@@_syllable_node.base),every~metrix~accent] + \node [every~metrix~syllable~node] (l_@@_syllable_node) {#1}; + \begin{pgfinterruptboundingbox} + \fill ($(l_@@_syllable_node.south) + + (0,\usemetrixvar{dotshift})$) + circle [radius=1.25\pgflinewidth]; + \end{pgfinterruptboundingbox} + \end{tikzpicture} + } +% \end{macrocode} +% \end{macro} +% \begin{macro}{\bow} +% This macro prints the bow below it's argument. +% \begin{macrocode} +\NewDocumentCommand { \bow } { m } + { + \begin{tikzpicture}[baseline=(l_@@_syllable_node.base),every~metrix~bow] + \node [every~metrix~syllable~node] (l_@@_syllable_node) {#1}; + \draw ($(l_@@_syllable_node.base~west)+ + (\usemetrixvar{bowshortening},\usemetrixvar{bowshift})$) + to [out=-45, in=225,looseness=\usemetrixvar{bowlooseness}] ($(l_@@_syllable_node.base~east)+ + (-\usemetrixvar{bowshortening},\usemetrixvar{bowshift})$); + \end{tikzpicture} + } +% \end{macrocode} +% \end{macro} +% +% \subsection{\TikZ styles} +% The \metrix package uses several \TikZ sytles to draw the macros. +% \begin{macrocode} +\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 +% \end{macrocode} +% +% \subsection{Environments} +% \begin{macro}{symbolline} +% Environment to display stand alone symbols. +% \begin{macrocode} +\NewDocumentEnvironment{symbolline} { } + { + \par\addvspace{\baselineskip} + \centering + } + { + \par\vspace{\baselineskip} + \noindent\ignorespacesafterend + } +% \end{macrocode} +% \end{macro} +% \begin{macro}[internal]{\@@_print_source:n} +% The internal macro to print the verse reference inside of +{metricvers}+ +% \begin{macrocode} +\cs_new:Npn \@@_print_vers_ref:n #1 + { + \hspace*{\fill}\nolinebreak[1] \quad \hspace*{\fill} \mbox{\footnotesize #1} + } +% \end{macrocode} +% \end{macro} +% \begin{macro}{metricverses,\verseref} +% Environment to display a verse with metric symbols and a source. And a macro to print +% a right aligned reference. +% \begin{macrocode} +\NewDocumentCommand { \verseref } { m } + { + \@@_error_msg:n { + \string\verseref\space can~only~be~used~in~{metricverses}~env. + } + } +\NewDocumentEnvironment{metricverses} { } + { + \RenewDocumentCommand { \verseref } { m } + { + \@@_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 + } +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +%</package> +% \end{macrocode} +% +% \end{implementation} +% +% \PrintChanges^^A use makeindex -s gglo.ist -o metrix-doc.gls metrix-doc.glo +% ^^A use updated=YYYY-MM-DD or new=YYY-MM-DD in {documentation} section +% \changes{v1.0}{2013/08/12}{Initial version} +% +% \PrintIndex^^A use: makeindex -s l3doc.ist -o metrix-doc.ind metrix-doc.idx
\ No newline at end of file diff --git a/Master/texmf-dist/source/latex/metrix/metrix.ins b/Master/texmf-dist/source/latex/metrix/metrix.ins new file mode 100644 index 00000000000..e123f651ef2 --- /dev/null +++ b/Master/texmf-dist/source/latex/metrix/metrix.ins @@ -0,0 +1,40 @@ +\iffalse meta-comment + +File metrix.ins 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 + +This file is part of the "l3packages bundle" (The Work in LPPL) +and all files in that bundle must be distributed together. + +The released version of this bundle is available from CTAN. + +\fi + +\input l3docstrip.tex +\askforoverwritefalse + +%\preamble +% +%EXPERIMENTAL CODE +% +%Do not distribute this file without also distributing the +%source files specified above. +% +%Do not distribute a modified version of this file. +% +%\endpreamble +%% stop docstrip adding \endinput +%\postamble +%\endpostamble + +\keepsilent + +\generate{\file{metrix.sty} {\from{metrix.dtx} {package}}} + +\endbatchfile
\ No newline at end of file |