Latin's scansion : length of vowels

The newunicodechar was written with this application in mind: directly typing characters with "strange" accents that are not covered by the standard utf8 option to inputenc, in particular vowel length for Latin.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{color}

\usepackage{newunicodechar}
%\newunicodechar{ă}{\u{a}} % not needed (already defined by the utf8 option)
\newunicodechar{ĕ}{\u{e}}
\newunicodechar{ĭ}{\u{\i}}
\newunicodechar{ŏ}{\u{o}}
\newunicodechar{ŭ}{\u{u}}
\newunicodechar{ā}{\={a}}
\newunicodechar{ē}{\={e}}
\newunicodechar{ī}{\={\i}}
\newunicodechar{ō}{\={o}}
\newunicodechar{ū}{\={u}}

%custom command: shortcut for formatting
\newcommand{\gr}[1]{\textbf{\color{red}#1}}
\newcommand{\ro}[1]{\textcolor{red}{#1}}
\newcommand{\g}[1]{\textbf{#1}}

\begin{document}

\title{Latin's Scansion}
\author{Evelyne}
\maketitle

\begin{tabular}{rlll}
734 & \ro{hās} \g{īn}\ro{tēr} / \g{pēs}\ro{tēs} // \g{dū}\ro{rō} /// 
\g{Că}tŏ \gr{mī}lĭtĕ \gr{sīc}cum  &   SSSD  & hhhh \\
\end{tabular} 
\end{document}

enter image description here


Lowering the duration marks for i

The page "lexilogos" removes the dot of the i. This can be achieved by using \i instead of i:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{color}
%custom command : shortcut for formating
\newcommand{\gr}[1]{{\bfseries \color{red}#1}}
\newcommand{\ro}[1]{{\color{red}#1}}
\newcommand{\g}[1]{{\bfseries #1}}

\begin{document}
\begin{tabular}{rlll}
734 & \ro{h\={a}s} \g{\={\i}n}\ro{t\={e}r} / \g{p\={e}s}\ro{t\={e}s} //
\g{d\=  {u}}\ro{r\={o}} /// \g{C\u{a}}t\u{o} \gr{m\={\i}}l\u{\i}t\u{e} 
\gr{s\={\i}c}cum  &   SSSD  & hhhh \\
\end{tabular}
\end{document}

Result

The same can be achieved by redefining \={i} and \u{i}:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{color}
%custom command : shortcut for formating
\newcommand{\gr}[1]{{\bfseries \color{red}#1}}
\newcommand{\ro}[1]{{\color{red}#1}}
\newcommand{\g}[1]{{\bfseries #1}}

\DeclareTextCompositeCommand{\=}{OT1}{i}{\=\i}
\DeclareTextCompositeCommand{\u}{OT1}{i}{\u\i}

\begin{document}

\begin{tabular}{rlll}
734 & \ro{h\={a}s} \g{\={i}n}\ro{t\={e}r} / \g{p\={e}s}\ro{t\={e}s} //
\g{d\=  {u}}\ro{r\={o}} /// \g{C\u{a}}t\u{o} \gr{m\={i}}l\u{i}t\u{e}
\gr{s\={i}c}cum  &   SSSD  & hhhh \\
\end{tabular}

\end{document}

Raising the duration marks to the same level

The duration marks for the other vowels can also be raised. The definitions are a little more complicate, because the position of the duration mark is measured, compared with the case i and raised to the same height.

Also the example shows, how to get rid of bold for the duration marks to get a more uniform appearance of the duration marks.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{color}
%custom command : shortcut for formating
\newcommand{\gr}[1]{{\bfseries \color{red}#1}}
\newcommand{\ro}[1]{{\color{red}#1}}
\newcommand{\g}[1]{{\bfseries #1}}

\newcommand*{\LongShortAux}[2]{%
  \begingroup
    \sbox0{\mdseries #1{}}%
    \sbox2{\mdseries #1{j}}% j is used instead of i to prevent endless loop
    \ooalign{%
      \hidewidth\raisebox{\dimexpr\ht2-\ht0\relax}{\mdseries#1{}}\hidewidth\cr
      \hfill#2\hfill
    }%
  \endgroup
}

\DeclareTextCompositeCommand{\=}{OT1}{a}{\LongShortAux{\=}{a}}
\DeclareTextCompositeCommand{\=}{OT1}{e}{\LongShortAux{\=}{e}}
\DeclareTextCompositeCommand{\=}{OT1}{i}{\LongShortAux{\=}{i}}
\DeclareTextCompositeCommand{\=}{OT1}{o}{\LongShortAux{\=}{o}}
\DeclareTextCompositeCommand{\=}{OT1}{u}{\LongShortAux{\=}{u}}

\DeclareTextCompositeCommand{\u}{OT1}{a}{\LongShortAux{\u}{a}}
\DeclareTextCompositeCommand{\u}{OT1}{e}{\LongShortAux{\u}{e}}
\DeclareTextCompositeCommand{\u}{OT1}{i}{\LongShortAux{\u}{i}}
\DeclareTextCompositeCommand{\u}{OT1}{o}{\LongShortAux{\u}{o}}
\DeclareTextCompositeCommand{\u}{OT1}{u}{\LongShortAux{\u}{u}}

\begin{document}
\begin{tabular}{rlll}
734 & \ro{h\={a}s} \g{\={i}n}\ro{t\={e}r} / \g{p\={e}s}\ro{t\={e}s} //
\g{d\=  {u}}\ro{r\={o}} /// \g{C\u{a}}t\u{o} \gr{m\={i}}l\u{i}t\u{e}
\gr{s\={i}c}cum  &   SSSD  & hhhh \\
\end{tabular}
\end{document}

Result

Remarks

  • \bfseries is preferred over \bf in LaTeX2e. The old font commands have problems if they are mixed (e.g. \it\bf: bold wins -- \itshape\bfseries: both bold and italics).

  • If another encoding is used (e.g. T1), then the \DeclareTextCompositeCommand lines need to be changed accordingly (e.g. OT1 to T1).

Combined solution with raised duration marks

This example combines:

  • The redefined accented characters with raised duration marks.
  • Unicode input (egreg's answer).
  • Better support for copy and pages (package accsupp).
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{color}
\usepackage{accsupp}
\usepackage{stringenc}
\usepackage{newunicodechar}

%custom command : shortcut for formating
\newcommand{\gr}[1]{{\bfseries \color{red}#1}}
\newcommand{\ro}[1]{{\color{red}#1}}
\newcommand{\g}[1]{{\bfseries #1}}

\newcommand*{\LongShortAux}[3]{%
  \begingroup
    \StringEncodingConvert{\x}{\detokenize{#3}}{utf8}{utf16be}%
    \BeginAccSupp{%
      unicode,%
      method=plain,%
      ActualText=\x
    }%
      \sbox0{\mdseries #1{}}%
      \sbox2{\mdseries #1{j}}%
      \ooalign{%
        \hidewidth\raisebox{\dimexpr\ht2-\ht0\relax}{\mdseries#1{}}\hidewidth
        \cr
        \hfill#2\hfill
      }%
    \EndAccSupp{}%
  \endgroup
}

\makeatletter
\newcommand*{\DeclareLatinDuration}[3]{%
  \DeclareTextCompositeCommand{#1}{\f@encoding}{#2}{%
    \LongShortAux{#1}{#2}{#3}%
  }%
  \@ifundefined{u8:\detokenize{#3}}{%
    \newunicodechar{#3}{#1{#2}}%
  }{}%
}
\makeatother

\DeclareLatinDuration{\=}{a}{ā}
\DeclareLatinDuration{\=}{e}{ē}
\DeclareLatinDuration{\=}{i}{ī}
\DeclareLatinDuration{\=}{o}{ō}
\DeclareLatinDuration{\=}{u}{ū}

\DeclareLatinDuration{\u}{a}{ă}
\DeclareLatinDuration{\u}{e}{ĕ}
\DeclareLatinDuration{\u}{i}{ĭ}
\DeclareLatinDuration{\u}{o}{ŏ}
\DeclareLatinDuration{\u}{u}{ŭ}

\begin{document}
\begin{tabular}{rlll}
734 & \ro{hās} \g{īn}\ro{tēr} / \g{pēs}\ro{tēs} //
\g{dū}\ro{rō} /// \g{Că}tŏ \gr{mī}lĭtĕ
\gr{sīc}cum  &   SSSD  & hhhh \\
\end{tabular}
\end{document}