%  mtxdoc.sty: macro package for writing documents with music examples  

%  Thanks to Daniel Taupin whose 'musixdoc.sty' is the source 
%  for some of these

%  Fonts and mark-up 

\newfont{\mflogo}{logo10 scaled 1200}
\font\tentt=\fontid tt10
\def\ital#1{{\sl #1\/}}
\def\textbs#1{\textbf{\textsl{#1}}}

%  Paper size

% A4
\newcommand{\paperAfour}{
\immediate\typeout{A4 paper size}
\global\textheight 240mm
\global\textwidth 160mm
\global\topmargin -16mm
\global\oddsidemargin 0mm}
% US Letter
\newcommand{\paperUS}{ 
\immediate\typeout{US paper size}
\textheight 9.2in 
\textwidth 6.5in
\topmargin -0.84in 
\oddsidemargin 0mm
}

%  Characters

\def\Bslash{\tt\char'134}
\def\|{{\tt\char'174}}
\def\LBR{{\tt\char'173}}
\def\RBR{{\tt\char'175}}
\def\snake{{\tt\char'176}}
\def\atsign{{\tt\char'100}}
\def\less{{\tt\char'074}}
\def\more{{\tt\char'076}}
\def\underscoreSymbol{\leavevmode \kern.06em \vbox{\hrule width.3em}}%

%  Logos

\def\mutex{M\raise\tw@\p@\hbox{\kern\m@ne\p@ u\kern\m@ne\p@}\TeX}
\def\MF{{\mflogo METAFONT}}
\def\unix{{\sc unix}}
\def\MTx{\textbs{{M-Tx}}}
\def\PMX{\textbf{PMX}}
\def\ABC{\textbf{\texttt{ABC2M\TeX}}}

%  Making an index

\long\def\theindex{\renewcommand{\thesection}{}\section{Index}\parindent\z@
  \parskip\z@ plus.3\p@\relax \let\item\@idxitem \columnseprule\z@
  \columnsep35\p@ \begin{multicols}{2}}
\def\endtheindex{\end{multicols}}
\def\keyindex#1{\leavevmode
 \hbox{\Bslash #1}\index{#1@{\protect\Bslash #1}}}
\def\zkeyindex#1{\index{#1@{\protect\Bslash #1}}}
\def\ixem#1{#1\index{#1}}
\def\itxem#1{\ital{#1}\index{#1}}
\def\ttxem#1{{\tt #1}\index{#1@{\tt #1}}}
\def\ibxem#1{{\bf#1}\index{#1}}
\def\mark#1{\underline{\ttxem{#1}}}
\def\printindex{\@input{\jobname.ind}}

%  Version highlighting

\def\current{ \version}
\def\newfrom{0.0}
\def\NEW#1{\ifdim#1 pt<\newfrom pt\else%
\index{NEW!\textsf{#1}}\marginpar{\fbox{\textsf{#1}}}\fi}

% -----------------------------------------------------------------
% -----------------------------------------------------------------

%  Preamble TeX commands for documents that contain .ex files
%   generated by M-Tx/PMX/tex2ex
\input musixcho
\input musixmad
\input pmx
\input musixlyr
\sepbarrules
\enableauxlyrics\def\AL{\auxlyr\lyr\nolyr}

%  If there is no file 'mypaper.tex' then \paperA4 is the default paper size. 
%  Historically 'mypaper.tex' was used to select paper size only.
%  It can of course contain any TeX macros suitable for the preamble.
\newread\mypaper
\openin\mypaper mypaper.tex\relax
\ifeof\mypaper\paperAfour\else\input mypaper.tex\fi\closein\mypaper

\newenvironment{mus}{\begin{minipage}{260mm}\begin{music}%
\let\atnextbar\relax\nobarnumbers}%
{\end{music}\assignlyrics1{}\assignlyrics2{}\end{minipage}}

\def\fullExample#1{
\noindent\begin{minipage}[t]{60mm}
\begin{mus} \vskip -10mm
\input{#1.ex}
\end{mus}
\end{minipage}\hskip 10mm
\begin{minipage}[c]{100mm}  \vskip 5mm
\verbatiminput{melisma1.mtx}
\end{minipage}}

\def\example#1{
\noindent\begin{minipage}[t]{60mm}
\begin{mus} \vskip -10mm
\input{#1.ex}
\end{mus}
\end{minipage}\hskip 10mm
\begin{minipage}[b]{90mm} \vskip 5mm
\verbatiminput{#1.mtb}
\end{minipage}}

\endinput


