1

I am trying to typeset some music in Latex. I will likely only need to do this once, so the relatively simple syntax of abc seemed perfect. Except that I cannot get it to work.

I have installed the abc package. I set the --shell-escape option for pdflatex, and I managed to install abcm2ps. I get the error that "ps2eps" cannot be found. I found ps2eps online, but one needs Pearl or C to install it, and both of them are far outside my expertise.

Do you have any idea how I could get abc to work? I use winedt on Windows 7, and MikTeX 2.9.

Unfortunately, the comments on this Stackexchange post did not solve the problem.

Here is some code that I would like to run (from https://martin-thoma.com/how-to-write-music-with-latex/):

\documentclass[a4paper]{article}
\usepackage{abc}

\begin{document}
    You can create music sheets within the abc-environment:
    \begin{abc}[name=c-dur]
        X: 1 % start of header
        K: C % scale: C major
        "Text"c2 G4 | (3FED c4 G2 |
    \end{abc}
\end{document}

Thank you for your help!

Edit: Here is what the winedt's console gives as the error message: (The German "Der Befehl "ps2eps" ist entweder falsch geschrieben oder konnte nicht gefunden werden." means that the command "ps2eps" is either spelled wrongly or cannot be found. I have no idea why that part is in German - winedt and miktex are in English, but windows is in German on my pc.)

Command Line:   pdflatex.exe --shell-escape --interaction=errorstopmode --synctex=-1 "beispiel_abc.tex" 
Startup Folder: C:\Users\wwa722\Dropbox\Hochzeit\Ablauf Kirche
This is pdfTeX, Version 3.14159265-2.6-1.40.17 (MiKTeX 2.9 64-bit)
entering extended mode
(beispiel_abc.tex
LaTeX2e <2016/03/31> patch level 1
Babel <3.9r> and hyphenation patterns for 75 language(s) loaded.
("C:\Program Files\MiKTeX 2.9\tex\latex\base\article.cls"
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
("C:\Program Files\MiKTeX 2.9\tex\latex\base\size12.clo"))
(C:\Users\wwa722\AppData\Roaming\MiKTeX\2.9\tex\latex\abc\abc.sty
("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\ifluatex.sty")
("C:\Program Files\MiKTeX 2.9\tex\latex\tools\verbatim.sty")
("C:\Program Files\MiKTeX 2.9\tex\latex\graphics\keyval.sty")
("C:\Program Files\MiKTeX 2.9\tex\latex\graphics\graphicx.sty"
("C:\Program Files\MiKTeX 2.9\tex\latex\graphics\graphics.sty"
("C:\Program Files\MiKTeX 2.9\tex\latex\graphics\trig.sty")
("C:\Program Files\MiKTeX 2.9\tex\latex\00miktex\graphics.cfg")
("C:\Program Files\MiKTeX 2.9\tex\latex\pdftex-def\pdftex.def"
("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\infwarerr.sty")
("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\ltxcmds.sty"))))
("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\ifpdf.sty"))
("C:\Program Files\MiKTeX 2.9\tex\latex\psnfss\mathptmx.sty")
No file beispiel_abc.aux.
("C:\Program Files\MiKTeX 2.9\tex\latex\psnfss\ot1ptm.fd")
(C:\Users\wwa722\AppData\Roaming\MiKTeX\2.9\tex\context\base\supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
) ("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\pdftexcmds.sty")
("C:\Program Files\MiKTeX 2.9\tex\latex\oberdiek\epstopdf-base.sty"
("C:\Program Files\MiKTeX 2.9\tex\latex\oberdiek\grfext.sty"
("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\kvdefinekeys.sty"))
("C:\Program Files\MiKTeX 2.9\tex\latex\oberdiek\kvoptions.sty"
("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\kvsetkeys.sty"
("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\etexcmds.sty"))))
("C:\Program Files\MiKTeX 2.9\tex\latex\psnfss\ot1ztmcm.fd")
("C:\Program Files\MiKTeX 2.9\tex\latex\psnfss\omlztmcm.fd")
("C:\Program Files\MiKTeX 2.9\tex\latex\psnfss\omsztmcm.fd")
("C:\Program Files\MiKTeX 2.9\tex\latex\psnfss\omxztmcm.fd")abcm2ps-8.12.1         (August 5, 2016)
File out-abc.abc
Output written on out-abc.ps (1 page, 1 title, 24453 bytes)
Der Befehl "ps2eps" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.

Sorry, but epstopdf did not succeed for the following reason:

  The input file does not exist.

The log file hopefully contains the information to get MiKTeX going again:

  C:/Users/wwa722/AppData/Local/MiKTeX/2.9/miktex/log/epstopdf.log

You may want to visit the MiKTeX project page, if you need help.
abcm2ps-8.12.1 (August 5, 2016)
File jacky.abc
Output written on jacky.ps (1 page, 1 title, 24894 bytes)
Der Befehl "ps2eps" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.

Sorry, but epstopdf did not succeed for the following reason:

  The input file does not exist.

The log file hopefully contains the information to get MiKTeX going again:

  C:/Users/wwa722/AppData/Local/MiKTeX/2.9/miktex/log/epstopdf.log

You may want to visit the MiKTeX project page, if you need help.
 [1{C:/Users/wwa722
/AppData/Local/MiKTeX/2.9/pdftex/config/pdftex.map}]

Package abc Warning: You have set the `shellescape' option, but you ran
(abc)                (pdf)latex without the `-shell-escape' command line
(abc)                option. Fix it either with the `noshellescape' option
(abc)                in your document or the correct call of (pdf)latex.

(beispiel_abc.aux) ){C:/Program Files/MiKTeX     2.9/fonts/enc/dvips/fontname/8r.en
c}<C:/Program Files/MiKTeX 2.9/fonts/type1/urw/times/utmr8a.pfb>
Output written on beispiel_abc.pdf (1 page, 15252 bytes).
SyncTeX written on beispiel_abc.synctex.
Transcript written on beispiel_abc.log.


_____________________________________________________________________

 PDFLaTeX Compilation Report (Pages: 1)

 Errors: 0   Warnings: 2   Bad Boxes: 0
_____________________________________________________________________
Dominika
  • 127
  • How did you install the package? Could you be more specific? From what I saw, abc package comes with MikTeX, so you need to install it through that :) – Yorgos Aug 16 '16 at 21:18
  • Hi Yorgos, I loaded the abc package in winedt. It then installs automatically when running latex. I also updated the formats and file name database in Miktex, and checked the package manager, just to be sure. It all looks good there. – Dominika Aug 18 '16 at 08:14

3 Answers3

2

Here is the summary of what you have to do, for all the other non-experts who want to use abc with windows. (The method is from Todd above, I am just summarizing it and including the answers to all my sub-questions)

  1. Download abcm2ps. Put the abcm2ps.exe in the same folder as the .tex-file.
  2. Use the sample input file below (by Todd, see the answer above). Name it abc3.tex
  3. Now you need to open the command prompt in windows. Adjusting latex etc. in WinEdt does NOT work. You can open the command prompt with Windows+X and select "command propmt"
  4. Change the directory to the one with your .tex-file. (write "cd C:\Users..." and press enter)
  5. Run "latex --shell-escape abc3" from the command prompt
  6. Run "abcm2ps -E -O out-abc out-abc" from the command prompt
  7. Rename out-abc001.eps in out-abc.eps
  8. Run "latex --shell-escape abc3"
  9. Run "dvips -o abc3.ps abc3.dvi"
  10. Run "ps2pdf abc3.ps"
  11. Run "pdflatex --shell-escape --interaction=errorstopmode --synctex=-1 abc3"

Now you have beautiful abc3.pdf. Rerunning it within WinEdt does not work for me.

\documentclass[a4paper,12pt]{article}
\usepackage[generate,ps2eps]{abc}
\begin{document}
\title{Example of ABC Plus in \LaTeX{}}
\author{Myself}
\date{}
\maketitle
You can create music sheets within the abc-environment:
\medskip

\begin{abc}
X:1 % comment
K:C % comment
"Text"c2 G4 | (3FED c4 G2 |
\end{abc}
\end{document}
Dominika
  • 127
1

Here you go. Yes, PS not building is your problem. I am using Ubuntu, and had similar/many issues. Now it works.

  • First, I installed the abcm2ps package on Ubuntu.
  • Next, forget about that sample file from Thoma. Unless, you want to switch to other musical-TeX?
  • Next, duplicate these two files in, Chapter 5 of "example file" from the abc package PDF. Link here.
  • Then, with those two files: abc2.tex & poll.abc, I ran.

    1: latex --shell-escape abc3 (Have to run this first!)

    2: pdflatex --shell-escape abc3

No errors. What happened to ps2eps issue? I see - this in my messages.

[Loading MPS to PDF converter (version 2006.09.02).]

gt7@perseus:~/...../3side$
$ pdflatex abc2
This is pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015/Debian) (preloaded format=pdflatex)
 restricted \write18 enabled.
entering extended mode
(./abc2.tex
LaTeX2e <2016/02/01>
Babel <3.9q> and hyphenation patterns for 81 language(s) loaded.
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size12.clo))
(/usr/share/texlive/texmf-dist/tex/latex/abc/abc.sty
(/usr/share/texlive/texmf-dist/tex/latex/tools/verbatim.sty)
(/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty)
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphicx.sty
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphics.sty
(/usr/share/texlive/texmf-dist/tex/latex/graphics/trig.sty)
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/graphics.cfg)
(/usr/share/texlive/texmf-dist/tex/latex/pdftex-def/pdftex.def
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/infwarerr.sty)
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ltxcmds.sty))))
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifpdf.sty))
(/usr/share/texlive/texmf-dist/tex/latex/psnfss/mathptmx.sty) (./abc2.aux)
(/usr/share/texlive/texmf-dist/tex/latex/psnfss/ot1ptm.fd)
(/usr/share/texlive/texmf-dist/tex/context/base/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
) (/usr/share/texlive/texmf-dist/tex/generic/oberdiek/pdftexcmds.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifluatex.sty))
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/grfext.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/kvdefinekeys.sty))
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/kvoptions.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/etexcmds.sty)))
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg))
(/usr/share/texlive/texmf-dist/tex/latex/psnfss/ot1ztmcm.fd)
(/usr/share/texlive/texmf-dist/tex/latex/psnfss/omlztmcm.fd)
(/usr/share/texlive/texmf-dist/tex/latex/psnfss/omsztmcm.fd)
(/usr/share/texlive/texmf-dist/tex/latex/psnfss/omxztmcm.fd)
<out-abc.pdf, id=1, 513.92pt x 243.91125pt> <use out-abc.pdf>
<jacky.pdf, id=2, 513.92pt x 246.9225pt> <use jacky.pdf> [1{/var/lib/texmf/font
s/map/pdftex/updmap/pdftex.map} <./out-abc.pdf> <./jacky.pdf>] [2] (./abc2.aux)
 ){/usr/share/texlive/texmf-dist/fonts/enc/dvips/base/8r.enc}</usr/share/texliv
e/texmf-dist/fonts/type1/urw/times/utmr8a.pfb>
Output written on abc2.pdf (2 pages, 39682 bytes).
Transcript written on abc2.log.

----> New Sample Input file: abc3.tex

\documentclass[a4paper,12pt]{article}
\usepackage[generate,ps2eps]{abc}
\begin{document}
\title{Example of ABC Plus in \LaTeX{}}
\author{Myself}
\date{}
\maketitle
You can create music sheets within the abc-environment:
\medskip

\begin{abc}
X:1 % comment
K:C % comment
"Text"c2 G4 | (3FED c4 G2 |
\end{abc}
\end{document}

===============

Part 2.

  • Yep, I was wrong. Created this sample file, closer to your first one.

  • Secret is, you need to run by latex command first. (latex --shell-escape abc3) You should have that also with a full MiKTeX installation.

  • Once, it makes the EPS (out-abc.eps) from the PS (out-abc.ps) run. Then you are home clear. (I presume you have installed the "abcm2ps" package, also. That is the app being called to make the PS - I presume?)
  • If that doesn't click. Then, your out of luck, sorry. (*) Get a Knoppix DVD with full LaTeX on it. Or find a friend with Linux and LTX; is all I can recommend.

  • Next. When the out-abc.ps & out-abc.eps files appear?, from "latex --shell-escape" running. It will then produce the EPS output files. Re-running with any latex build-latex processors then works.

# This clears the EPS built files, to test this bugger truly runs?

rm -v out-abc.eps out-abc.ps

# You have to run it, this way: first time. Once builds the EPS. All else works on Ubuntu.

latex --shell-escape abc3

dvips -o abc3.ps abc3.dvi

ps2pdf abc3.ps

# Creates one version of the PDF output.

pdflatex --shell-escape --interaction=errorstopmode --synctex=-1 abc3

# When I run this now, (pdflatex) creates a 2nd bit smaller PDF & abc3.synctex output file.

  • Replace abc3 with beispiel_abc, for your work.

Thats all I got, man

  • I'd avoid the \abcinput{} package command. It doesn't seem to be working. Just keep your data inside the tex source. Using pdflatex no options, returns no error. Night – Bob Nelson Gcdr Aug 16 '16 at 22:19
  • Hi Glen, thanks for your help. Unfortunately, I get the same error with "ps2eps" also when running the example file from the abc package. I'll add the full log to my original question, maybe you can see there what goes wrong. – Dominika Aug 18 '16 at 08:00
  • Hi Glen, thanks! When doing as you describe with your example, I get two ps files, abc.ps and out-abc.ps. When I run ps2pdf on both, the abc.ps generates a file with a box instead of the music, and out-abc.ps generates (just) the music. When I rerun latex or pdflatex on the original tex file, I get also a pdf with a box instead of the music. So, I think I'm getting closer, but how do I get the music to be in the pdf? – Dominika Aug 19 '16 at 07:36
  • Hi Dominika, (+) Unless you have the abcm2ps program? (+) You'll never get past the error, you are having. (+) If I rename it on my box, to hide it? latex --shell-escape .. Cannot finish without the error. (+) Running it directly: abcm2ps -E -O out-abc out-abc (*) Is how latex calls it. (+) Otherwise, switch to LilyPond. Good luck Glen – Bob Nelson Gcdr Aug 19 '16 at 19:37
  • Now it works! Thank you!! I really have to run it via the command prompt, just adding the options in winedt doesn't do it. – Dominika Aug 21 '16 at 17:29
0

A bit late to the party, but I have made this work within LaTeX (I am using TeXstudio) rather than having to use command prompt, the instructions already given here above are the best I could find online (I couldn't have solved this without them), and I would like to provide my solution in case others find it of use. Feel free to edit this if necessary, and especially if I have failed to adhere to any conventions.

THE PROBLEMS

(1) shell escape problem

    Package abc Warning: You have set the `shellescape' option, but you ran (pdf)latex 
    without the `-shell-escape' command line option. Fix it either with the 
    `noshellescape' option in your document or the correct call of (pdf)latex

(In fact, as long as you have performed the -shell-escape or -enable-write18 step, this error is actually erroneous, and is an artefact of one of the other problems.)

(2) abcm2ps problem

    'abcm2ps' is not recognized as an internal or external command, operable program or batch file

(This is resolved by adding a PATH to 'abcm2ps.exe'. See below for instructions.)

(3) ps2eps problem

    'ps2eps' is not recognized as an internal or external command, operable program or batch file

(This is resolved by adding a PATH to 'bbox.exe', adding the extension '.pl', changing the extension of 'ps2eps' to 'ps2eps.pl', and adding a PATH to 'ps2eps.pl'. See below for instructions.)

(4) gswin32c problem

    'gswin32c' is not recognized as an internal or external command, operable program or batch file

(This problem may not become apparent until after problems (2) and (3) have been solved. It is resolved by renaming 'gswin64c' to 'gswin32c', and by adding a PATH to 'gswin32c.exe'. See below for instructions.)

THE SOLUTIONS

(1) DOWNLOADS

(1.1) Download abcm2ps: https://github.com/leesavide/abcm2ps/. This doesn't need to be installed. Put it in a folder somewhere it can stay.

(1.2) Download and install Perl: https://www.perl.org/get.html.

(1.3) Download ps2eps: https://ctan.org/tex-archive/support/ps2eps. This doesn't need to be installed. Put it in a folder somewhere it can stay.

(1.4) Download and install Ghostscript: https://www.ghostscript.com/download.html.

(2) EXTENSIONS

(2.1) Navigate to 'Environment Variables': settings > about > system info > advanced system settings > environment variables. Click 'PATHEXT' in 'System variables', then click 'Edit'. In the 'Edit System Variable' window, add '.PL;' to the end of the list in 'Variable value'. Make sure you don't add any spaces.

(2.2) Find the 'ps2eps' file, and change its extension (I just did it by changing the file name) to 'ps2eps.pl'.

(2.3) Look for the 'gswin32c.exe' file. If it exists, ignore this step. If it doesn't exist, find the 'gswin64c.exe' file, copy and paste it, and rename the new file 'gswin32c.exe'.

(3) PATHS

(3.1) Navigate to 'Environment Variables': settings > about > system info > advanced system settings > environment variables. Click 'Path' in 'System variables', then click 'Edit'.

(3.2) In the 'Edit environment variable' window, click 'New' and then 'Browse'. Find the folder containing 'abcm2ps.exe' and add it to this list.

(3.3) Repeat (3.2) for 'ps2eps.pl'.

(3.4) Repeat (3.2) for 'bbox.exe' (which is in ps2eps\bin\win32).

(3.5) Repeat (3.2) for 'gswin32c'.

(4) LATEX

Note: I use TeXstudio and compile with PdfLaTeX, so instructions are for that. But it shouldn't be too difficult to work out what adjustments need to be made to the following instructions for different configurations.

(4.1) In Options > Configure TeXstudio > Commands, the command for PdfLaTeX might currently be:

    pdflatex.exe -synctex=1 -interaction=nonstopmode %.tex

Change it to:

    pdflatex.exe -synctex=1 -interaction=nonstopmode -enable-write18 %.tex

If that doesn't work, try:

    pdflatex.exe -synctex=1 -interaction=nonstopmode -shell-escape %.tex

Note: some people have raised security worries about doing this, so look it up.

(4.2) Compile the document first with LaTeX.

(4.3) Compile the document with PdfLaTeX.

And now it should work.

Matt
  • 21