summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2008-03-08 23:20:19 +0000
committerKarl Berry <karl@freefriends.org>2008-03-08 23:20:19 +0000
commitd6767c07e4b1da71175894668d79303343af63f2 (patch)
tree69c2d7056589eff6b2dbc3a49bced1220eb06c08 /Master/texmf-dist/source/latex
parent528aaa7971899a4d43d0b074b87872929e004cf9 (diff)
abc 2 (8mar08)
git-svn-id: svn://tug.org/texlive/trunk@6902 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex')
-rw-r--r--Master/texmf-dist/source/latex/abc/abc.dtx292
-rw-r--r--Master/texmf-dist/source/latex/abc/abc.ins5
2 files changed, 263 insertions, 34 deletions
diff --git a/Master/texmf-dist/source/latex/abc/abc.dtx b/Master/texmf-dist/source/latex/abc/abc.dtx
index 582601a6e19..54508b8deeb 100644
--- a/Master/texmf-dist/source/latex/abc/abc.dtx
+++ b/Master/texmf-dist/source/latex/abc/abc.dtx
@@ -23,7 +23,7 @@
%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<package>\ProvidesPackage{abc}
%<*package>
- [2006/03/22 v1.0 Enrico Gregorio]
+ [2008/03/03 v2.0 Enrico Gregorio]
%</package>
%<*driver>
\documentclass{ltxdoc}
@@ -38,7 +38,7 @@
%</driver>
% \fi
%
-% \CheckSum{292}
+% \CheckSum{397}
%
% \CharacterTable
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@@ -56,6 +56,12 @@
% Grave accent \` Left brace \{ Vertical bar \|
% Right brace \} Tilde \~}
%
+% \changes{v2.0}{2008/03/03}{Many changes, in order to allow for Mup
+% support; added saveall and nosaveall options}
+%
+% \changes{v1.1}{2007/03/27}{Added \cs{endgroup} when the warning for
+% a non existent file is issued}
+%
% \changes{v1.0}{2006/03/22}{After long delay decided to publish it}
%
% \changes{v0.7}{2005/11/21}{Corrected some errors from previous
@@ -88,9 +94,13 @@
% \DoNotIndex{\verbatim@processline,\verbatim@start,\write}
% \DoNotIndex{\@makeother,\IfFileExists,\ProcessOptions}
% \DoNotIndex{\@ifnextchar,\define@key,\MessageBreak,\setkeys}
-% \DoNotIndex{\^}
+% \DoNotIndex{\stepcounter,\newcounter,\trivlist,\AtEndDocument}
+% \DoNotIndex{\@empty,\edef,\csname,\endcsname,\edef,\begingroup}
+% \DoNotIndex{\endgroup,\endtrivlist,\global,\if,\ifx,\item}
+% \DoNotIndex{\PackageWarningNoLine,\PassOptionsToPackage}
+% \DoNotIndex{\ProvidesPackage,\@arabic}
%
-% \title{The \textsf{abc} class\thanks{This document corresponds to
+% \title{The \textsf{abc} package\thanks{This document corresponds to
% \textsf{abc}~\fileversion, dated \filedate.}}
%
% \author{Enrico Gregorio \\ \texttt{Enrico dot Gregorio at univr dot it}}
@@ -123,6 +133,16 @@
% \textsc{pdf}\LaTeX{}, without any change in the user's source file.
% It employs also the package \textsf{keyval} by David Carlisle and
% ideas from the \textsf{verbatim} package in the \LaTeX{} tools.
+%
+% Martin Tarenskeen wrote me about possible support of Mup--Music
+% Publisher\footnote{\texttt{http://www.arkkra.com}} and actually it
+% was easy to add it along with some improvements partly suggested by
+% him. Therefore the package now comes along with a new \textsf{mup}
+% package; see section~\ref{mup}. I owe many thanks to Martin for
+% testing the new version.
+%
+% We are studying whether it is feasible to extend support also to
+% other music printing programs like Lilypond.
%
% \section{Usage}
% \DescribeEnv{abc}
@@ -142,7 +162,8 @@
% for the temporary file which will be output and massaged by
% \texttt{abcm2ps}. \emph{Warning}: the extension \texttt{.abc} is
% automatically added to the file name; esistent files with the same
-% name will be silently erased (to be changed in future versions).
+% name will be silently erased. If the keyword is specified without a
+% value, then the output file receives a unique name.
%
% \item[\normalfont\texttt{options=}\meta{options}:] \meta{options}
% are command line parameters to the \texttt{abcm2ps} utility; the
@@ -170,6 +191,10 @@
% \item[\normalfont\texttt{center}:] This is a boolean, either true
% or false; the default is true, if left flush alignment is preferred,
% specify \texttt{center=false}.
+%
+% \item[\normalfont\texttt{extension}:] This keyword seems practically
+% useless, but is needed if one needs to input both ABC and Mup files
+% in one and the same document. See later on.
% \end{description}
%
% \DescribeMacro{\abcinput}
@@ -232,10 +257,22 @@
% a system where the utility \texttt{ps2epsi} generates a file with
% three letter extension \texttt{.epi}.
%
+% \subsection{\texttt{nosaveall} and \texttt{saveall}}
+% The first is the default, but the second is called implicitly when
+% the \texttt{noshellescape} is given. When the \texttt{saveall}
+% option is active, every `abc' environment produces a unique output
+% file; in other words, the \texttt{name} keyword, without value, is
+% given for every environment. So the \texttt{noshellescape} option
+% along with \texttt{generate} will not overwrite the output from
+% unnamed environment. It is possible that, during the document's
+% preparation, the numbers added to the default file name are out of
+% synch, the process should converge.
+%
+%
% \section{Compiling documents}
% Users must give the option \texttt{-shell-escape} when compiling
-% their documents (unless they chose the \texttt{nogenerate} package
-% option. Thus one of
+% their documents, unless they chose the \texttt{nogenerate} package
+% option or the \texttt{noshellescape}. Thus one of
% \begin{quote}
% \texttt{latex -shell-escape} \meta{\TeX{} file name}\\
% \texttt{pdflatex -shell-escape} \meta{\TeX{} file name}\\
@@ -337,10 +374,127 @@ K:Amix
%</abc>
% \fi
%
-% \section{To do}
-% Find a robust way to assign a unique name to output files. With
-% \verb|\label| and \verb|\ref|, probably.
+% \section{Mup support}\label{mup}
+% Everything we have said about ABC translates verbatim for Mup.
+% Simply call the package with
+% \iffalse
+%<*verb>
+% \fi
+\begin{verbatim}
+\usepackage{mup}
+\end{verbatim}
+% \iffalse
+%</verb>
+% \fi
+
+% with options just like before, and substitute the string `mup' to
+% every occurrence of `abc' in the preceding sections. The only
+% differences are in the default command line options when calling the
+% external program (they are \texttt{-F} for `mup').
%
+% It is even possible to use both external programs in the same
+% document. If this is desired, call the \textsf{abc} package and
+% define a new environment for Mup inclusion as follows
+% \iffalse
+%<*verb>
+% \fi
+\begin{verbatim}
+\newenvironment{mup}[1][]
+ {\renewcommand{\normalabcoutputfile}{out-mup}%
+ \abc[program=mup,options={-F},extension=mup,#1]}
+ {\endabc}
+\newcommand{\mupinput}[2][]{%
+ \abcinput[program=mup,options={-F},extension=mup,#1]{#2}}
+\end{verbatim}
+% \iffalse
+%</verb>
+% \fi
+%
+% Here is an example with Mup.
+%
+% \iffalse
+%<*example-mup>
+% \fi
+% \begin{smallverb}
+\documentclass[a4paper,12pt]{article}
+\usepackage[generate,ps2eps]{mup}
+\usepackage{mathptmx}
+
+\begin{document}
+
+\title{Example of MUP in \LaTeX{}}
+\author{Martin Tarenskeen}
+\date{}
+\maketitle
+
+This is a short piece.
+
+\medskip
+
+\begin{mup}
+1: a-;b-;c;d;
+bar
+1: e;f;g;a;
+endbar
+\end{mup}
+
+\medskip
+
+This is another short piece, but we would like to keep the
+MUP source in our directory.
+
+\begin{mup}[name=mymup]
+score
+staffs=2
+time=6/8
+beamstyle=4.,4.
+
+staff 2
+clef=bass
+
+music
+1: 8c;d;e;f;g;a;
+2: 4.ceg;cfa;
+repeatend
+
+\end{mup}
+
+\clearpage
+
+And finally, we want to set also the last piece; its MUP code
+is already in our directory.
+
+\medskip
+
+\mupinput{simple}
+
+\end{document}
+% \end{smallverb}
+% \iffalse
+%</example-mup>
+% \fi
+% This file is accompanied by a file \texttt{simple.mup}
+% \iffalse
+%<*mup>
+% \fi
+% \begin{smallverb}
+score
+staffs=2
+time=6/8
+beamstyle=4.,4.
+
+staff 2
+clef=bass
+
+music
+1: 8c;d;e;f;g;a;
+2: 4.ceg;cfa;
+repeatend
+% \end{smallverb}
+% \iffalse
+%</mup>
+% \fi
+%
% \StopEventually{\PrintChanges\PrintIndex}
%
% \section{The implementation}
@@ -352,10 +506,16 @@ K:Amix
\newif\ifabc@shellescape
\newif\ifabc@generate
\newif\ifabc@warning
-\DeclareOption{noshellescape}{\abc@shellescapefalse\abc@warningtrue}
+\newif\ifabc@saveall
+\newif\ifabc@mup
+\DeclareOption{mup}{\abc@muptrue}
+\DeclareOption{noshellescape}{\abc@shellescapefalse\abc@warningtrue
+ \abc@savealltrue}
\DeclareOption{shellescape}{\abc@shellescapetrue}
\DeclareOption{nogenerate}{\abc@generatefalse}
\DeclareOption{generate}{\abc@generatetrue}
+\DeclareOption{nosaveall}{\abc@saveallfalse}
+\DeclareOption{saveall}{\abc@savealltrue}
% \end{macrocode}
% The following options control the external programs to use.
% \begin{macrocode}
@@ -366,7 +526,7 @@ K:Amix
% \end{macrocode}
% Now we declare the default options and call the user specified ones.
% \begin{macrocode}
-\ExecuteOptions{generate,shellescape,ps2eps}
+\ExecuteOptions{generate,shellescape,nosaveall,ps2eps}
\ProcessOptions\relax
% \end{macrocode}
%
@@ -381,15 +541,40 @@ K:Amix
\RequirePackage{graphicx}
\RequirePackage{ifpdf}
% \end{macrocode}
-% Next we define some internal commands. We choose to give explicitly
-% the extensions to the graphics files, since some user could prefer
-% \texttt{ps2epsi}.
+% Next we define some internal commands. First of all a boolean for
+% issuing messages if necessary and a counter to assign unique names
+% to output files
% \begin{macrocode}
+\newif\ifabc@unprocessedfiles
+\newcounter{abc@count}
+% \end{macrocode}
+% We choose to give explicitly the extensions to the graphics files,
+% since some user could prefer \texttt{ps2epsi}. Everything is
+% doubled for Mup support.
+% \begin{environment}{mup}
+% \begin{macro}{\mupinput}
+% \begin{macrocode}
+\ifabc@mup
+\newcommand{\abc@cmd}{mup} % virtually no choice
+\newcommand{\abc@parm}{-F} % -F MUST stay
+\newcommand{\abc@epstopdfcmd}{epstopdf}
+\newcommand{\abc@pdfext}{pdf}
+\def\normalabcoutputfile{out-mup}
+\def\normalmupoutputfile{\normalabcoutputfile}
+\def\mup{\abc}
+\def\endmup{\endabc}
+\def\mupinput{\abcinput}
+\def\abc@ext{.mup}
+\def\abc@packagename{mup}
+\else
\newcommand{\abc@cmd}{abcm2ps} % virtually no choice
\newcommand{\abc@parm}{-O= -c} % -O= MUST stay
\newcommand{\abc@epstopdfcmd}{epstopdf}
\newcommand{\abc@pdfext}{pdf}
\def\normalabcoutputfile{out-abc}
+\def\abc@ext{.abc}
+\def\abc@packagename{abc}
+\fi
\def\abc@tempfile{\normalabcoutputfile}
\def\abc@opt{}
\let\abc@postopt\@empty
@@ -401,10 +586,13 @@ K:Amix
\newif\ifabc@center
\abc@centertrue
% \end{macrocode}
+% \end{macro}
+% \end{environment}
% The following is the only parameter the user is authorized to
-% tamper with.
+% tamper with; it has an alias for Mup.
% \begin{macrocode}
\newcommand{\abcwidth}{\linewidth} % only fractions of \linewidth
+\let\mupwidth\abcwidth
% \end{macrocode}
% \begin{macro}{\abc@startgen}
% \begin{macro}{\abc@finishgen}
@@ -418,7 +606,7 @@ K:Amix
\newwrite\abc@out
\def\abc@startgen{%
\@bsphack
- \immediate\openout\abc@out\abc@tempfile.abc
+ \immediate\openout\abc@out\abc@tempfile\abc@ext
\let\do\@makeother\dospecials
\catcode`\^^M\active \catcode`\^^I=12
\def\verbatim@processline{%
@@ -445,10 +633,17 @@ K:Amix
% \begin{macrocode}
\def\abc@doshellcommand{%
\immediate\write18{%
- \abc@cmd\space
- \abc@parm\space
- \abc@opt\space
- \abc@tempfile.abc
+ \ifabc@mup
+ \abc@cmd\space
+ \abc@opt\space
+ \abc@parm\space
+ \abc@tempfile\abc@ext\space
+ \else
+ \abc@cmd\space
+ \abc@parm\space
+ \abc@opt\space
+ \abc@tempfile\abc@ext\space
+ \fi
\ifx\abc@postopt\@empty
\else\space\abc@postopt\fi}%
\immediate\write18{%
@@ -463,7 +658,7 @@ K:Amix
\abc@cmd\space
\abc@parm\space
\abc@opt\space
- \abc@tempfile.abc
+ \abc@tempfile\abc@ext\space
\ifx\abc@postopt\@empty
\else\space\abc@postopt\fi}%
\immediate\write\abc@outsh{%
@@ -479,12 +674,22 @@ K:Amix
% \texttt{nogenerate} option was chosen.
% \begin{macrocode}
\AtEndDocument{%
- \ifabc@warning
- \PackageWarningNoLine{abc}{%
- Remember to generate the [eps,pdf] files before compiling%
- \MessageBreak
- again. Use the file \abc@tempfile.sh for a list or as a script}%
- \fi}
+ \ifabc@warning\ifabc@unprocessedfiles
+ \PackageWarningNoLine{\abc@packagename}{%
+ \ifabc@shellescape
+ You have set the `shellescape' option, but you ran%
+ \MessageBreak
+ (pdf)latex without the `-shell-escape' command line%
+ \MessageBreak
+ option. Fix it either with the `noshellescape' option%
+ \MessageBreak
+ in your document or the correct call of (pdf)latex%
+ \else
+ Remember to generate the [eps,pdf] files before compiling%
+ \MessageBreak
+ again. Use the file \abc@tempfile.sh for a list or as a script%
+ \fi}%
+ \fi\fi}
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -526,13 +731,25 @@ K:Amix
% ``out-abc'' which should not clobber any existing file.
% \begin{macrocode}
\def\abc{\@ifnextchar[\abc@grab{\abc@grab[]}}
-\define@key{abc}{name}{\def\abc@tempfile{#1}}
+\define@key{abc}{name}[]{%
+ \if!#1!\stepcounter{abc@count}%
+ \edef\abc@tempfile{\normalabcoutputfile-\@arabic\c@abc@count}%
+ \else
+ \def\abc@tempfile{#1}%
+ \fi
+}
\define@key{abc}{options}{\def\abc@opt{#1}}
\define@key{abc}{postoptions}{\def\abc@postopt{#1}}
\define@key{abc}{program}{\def\abc@cmd{#1}\let\abc@parm\@empty}
\define@key{abc}{width}{\def\abc@width{#1}}
\define@key{abc}{center}[true]{\csname abc@center#1\endcsname}
-\def\abc@grab[#1]{\let\abc@width=\abcwidth\setkeys{abc}{#1}\abc@start}
+\define@key{abc}{extension}{\def\abc@ext{.#1}}
+\def\abc@grab[#1]{\let\abc@width=\abcwidth
+ \ifabc@saveall
+ \setkeys{abc}{name,#1}%
+ \else
+ \setkeys{abc}{#1}%
+ \fi\abc@start}
% \end{macrocode}
% The final part of the environment; we do the processing, if
% required and then include the graphics file. If none is found, the
@@ -543,7 +760,8 @@ K:Amix
\trivlist\item[]\ifabc@center\centering\fi
\IfFileExists{\abc@tempfile.\abc@finalext}
{\includegraphics[width=\abc@width]{\abc@tempfile.\abc@finalext}}%
- {\global\abc@warningtrue\fbox{\abc@tempfile}}%
+ {\global\abc@warningtrue\fbox{\abc@tempfile}%
+ \global\abc@unprocessedfilestrue}%
\endtrivlist
}
% \end{macrocode}
@@ -553,7 +771,7 @@ K:Amix
\def\abcinput{\@ifnextchar[\abc@grabinput{\abc@grabinput[]}}
\def\abc@grabinput[#1]#2{\let\abc@width=\abcwidth\setkeys{abc}{#1}%
\begingroup\def\abc@tempfile{#2}%
- \IfFileExists{\abc@tempfile.abc}
+ \IfFileExists{\abc@tempfile\abc@ext}
{%
\abc@process
\begin{center}
@@ -563,10 +781,18 @@ K:Amix
\end{center}%
\endgroup
}
- {\PackageWarning{abc}{No file \abc@tempfile.abc found}}%
+ {\PackageWarning{\abc@packagename}{No file \abc@tempfile\abc@ext\space found}}%
}
%</package>
% \end{macrocode}
% \end{macro}
% \end{environment}
+% \begin{macrocode}
+%<*package-mup>
+\ProvidesPackage{mup}
+\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{abc}}
+\ProcessOptions\relax
+\RequirePackage[mup]{abc}
+%</package-mup>
+% \end{macrocode}
% \Finale
diff --git a/Master/texmf-dist/source/latex/abc/abc.ins b/Master/texmf-dist/source/latex/abc/abc.ins
index aacc1725eab..e35f358c2fa 100644
--- a/Master/texmf-dist/source/latex/abc/abc.ins
+++ b/Master/texmf-dist/source/latex/abc/abc.ins
@@ -20,7 +20,7 @@
\input docstrip
\preamble
- Copyright 2006 Enrico Gregorio
+ Copyright 2006, 2008 Enrico Gregorio
This program is provided under the terms of the
LaTeX Project Public License distributed from CTAN
@@ -39,8 +39,11 @@
\Msg{*** Generating the package files ***}
\generate{\file{abc.sty}{\from{abc.dtx}{package}}%
\file{example.tex}{\from{abc.dtx}{example}}%
+ \file{mup.sty}{\from{abc.dtx}{package-mup}}%
+ \file{mupexa.tex}{\from{abc.dtx}{example-mup}}%
\nopreamble\nopostamble
\file{poll.abc}{\from{abc.dtx}{abc}}%
+ \file{simple.mup}{\from{abc.dtx}{mup}}%
}
\Msg{***********************************************************}