[OS X TeX] TeXShop and Metapost: labels can't be typesetted with LaTeX
Claus Gerhardt
gerhardt at math.uni-heidelberg.de
Wed Sep 27 01:15:43 CEST 2006
Sorry, I wasn't aware that your example file should be saved as a .mp
file. In this case the script below should do the trick.
The script needs Flashmode-downloadable because of the subroutine.
Claus
tell application "TeXShop"
get path of document of window 1
set fileName to result
end tell
set scriptPath to (do shell script "dirname " & "~/Library/Flashmode/
Subroutines/ex")
set scriptPath to scriptPath & "/setnametsn.scpt"
set scriptName to POSIX file scriptPath as alias
set scriptLiB to (load script scriptName)
tell scriptLiB
set {baseName, texName, pdfName, namePath, dirName, dirNameunquoted,
logName, logPath, rtfName, docName} to setnametsn(fileName)
end tell
set shellScript to "cd " & dirName & ";"
set shellScript to shellScript & "~/Library/TeXShop/bin/mpostc " &
baseName
do shell script shellScript
On Sep 26, 2006, at 23:13, Franck Pastor wrote:
>
> Le 26-sept.-06 à 19:24, Claus Gerhardt a écrit :
>
>> In ~/Library/TeXShop/bin is a shell script mpostc. Add the option -
>> tex=latex to its command. The Applescripts mpostc or mpostcpl will
>> then produce what you want.
>>
>> Claus
>>
>>
>
>
> Thanks! mpostcpl does the tricks, as I use mfpic :-)
>
> However, if I want to compile a Metapost file with mpostc, it
> doesn't work ("Applescript Error : TeXShop got an error:
> NSReceveirEvaluationScriptError: 4"). I'm starting to think that
> the best way to deal with this problem would be a panel in the
> preferences...
>
> Franck Pastor
>
>> On Sep 26, 2006, at 18:33, Franck Pastor wrote:
>>
>>> Hello,
>>>
>>> I am using Metapost (mainly via the package "mfpic", but also the
>>> Metapost language itself) for my pictures, and as TeXShop
>>> supports Metapost, I thought I could use it to write my programs
>>> and run them. But I have a problem. Metapost uses internally
>>> Plain TeX by default to typeset labels in a figure, and I would
>>> like to make it use LaTeX instead.
>>>
>>> For example, this little program (let's call it "example.mp") is
>>> supposed to use LaTeX to typeset its label (hence the
>>> "verbatimtex...etex" block):
>>>
>>> verbatimtex
>>> \documentclass{article}
>>> \begin{document}
>>> etex
>>> beginfig(1);
>>> z0 = (0,0);
>>> z1 = (sqrt(5)*cm,0);
>>> draw z0--z1;
>>> label.bot(btex $\sqrt{5}$ etex, 1/2[z0,z1]);
>>> endfig;
>>> end;
>>>
>>> In the Terminal, with the command line, you have only to enter
>>>
>>> mpost -tex=latex example.mp
>>>
>>> to obtain your figure, with the square root of 5. But via
>>> TeXShop, as it is, it's not possible, you don't obtain anything...
>>>
>>> After some research, I managed to find this small file, inside
>>> TeXShop itself:
>>>
>>> /Applications/TeXShop.app/Contents/Resources/metapostwrap
>>>
>>> I don't know exactly what it does, but I took the risk to change
>>> the following lines :
>>>
>>> mpost --interaction=nonstopmode "${filename:r}.mp"
>>> mpost "${filename:r}.mp"
>>>
>>> into
>>>
>>> mpost --interaction=nonstopmode -tex=latex "${filename:r}.mp"
>>> mpost -tex=latex "${filename:r}.mp"
>>>
>>> and with this change, I can execute my file conveniently.
>>>
>>> My questions: is there another (simpler) way to do that in
>>> TeXShop? If not, would it be possible to have a panel of choices
>>> in the preferences of TeXShop, offering us the choice between
>>> Plain TeX (default) and LaTeX for typesetting labels when using
>>> the Metapost program? Something to be placed in the "Misc"
>>> section, for example, alongside with the choice of mptopdf or
>>> mpost to run Metapost. That would prevent us to do the changes
>>> ourselves in the "metapostwrap" files, which is a bit tedious at
>>> each update of TeXShop.
>>>
>>> Many thanks for having managed to read this! I hope it's not too
>>> badly written...
>>>
>>> Franck Pastor
>>>
>>>
>>> ------------------------- Info --------------------------
>>> Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
>>> & FAQ: http://latex.yauh.de/faq/
>>> TeX FAQ: http://www.tex.ac.uk/faq
>>> List Archive: http://tug.org/pipermail/macostex-archives/
>>>
>>
>> ------------------------- Info --------------------------
>> Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
>> & FAQ: http://latex.yauh.de/faq/
>> TeX FAQ: http://www.tex.ac.uk/faq
>> List Archive: http://tug.org/pipermail/macostex-archives/
>>
>
> ------------------------- Info --------------------------
> Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
> & FAQ: http://latex.yauh.de/faq/
> TeX FAQ: http://www.tex.ac.uk/faq
> List Archive: http://tug.org/pipermail/macostex-archives/
>
------------------------- Info --------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
& FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/
More information about the macostex-archives
mailing list