[OS X TeX] Re: Some ideas LaTeX on iPad, iPhone, etc.
Ramón Figueroa-Centeno
ramonf at hawaii.edu
Tue Mar 23 05:41:23 CET 2010
Aloha,
Let me reply my own question :)
Our goal is to have a folder such that any change to the folder will trigger
an execution of pdflatexmk on all the files within with suffix "tex" in the
folder. In my case I want the folder to be inside my DropBox folder, So I
assume my target folder is "~/DropBox/LaTeXMe". I assume that you have
TeXShop installed and Herb Schultz's pdflatexmk engine enabled (that is, you
moved ~/Library/TeXShop/Engines/Inactive/Latexmk/pdflatexmk.engine to
~/Library/TeXShop/Engines/)
Here are the steps:
1. In a text editor create a bash script, which I did in ~/bin/latexme.sh,
that will create the folder if it does not exist, cd to it, and run
pdflatexmk on all the ".tex" files therein:
#!/bin/sh
engine="$HOME/Library/TeXShop/Engines/pdflatexmk.engine"
LaTeXMeDir="$HOME/Dropbox/LaTeXMe"
mkdir -p $LaTeXMeDir
cd $LaTeXMeDir
find . -type f -name '*.tex' -execdir $engine '{}' \;
3. Make sure the script is executable, e.g. type in the Terminal "chmod +x
~/bin/latexme.sh" (no quotations, of course).
2. In a text editor create a "Launch Agent" (say
~/Library/LaunchAgents/com.ramonfigueroacenteno.LaTeXMe.plist) to watch our
LaTeXMe folder for changes and trigger the script:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<false/>
<key>Label</key>
<string>com.ramonfigueroacenteno.LaTeXMe</string>
<key>ProgramArguments</key>
<array>
<string>/Users/ramon/bin/latexme.sh</string>
</array>
<key>QueueDirectories</key>
<array/>
<key>WatchPaths</key>
<array>
<string>/Users/ramon/Dropbox/LaTeXMe</string>
</array>
</dict>
</plist>
4. Load your Launch Agent, e.g. "launchctl load
~/Library/LaunchAgents/com.ramonfigueroacenteno.LaTeXMe.plist" in the
Terminal.
Note that give that the script is very short one could easily inbed it the
Launch Agent, but I prefer it this way since I can more easily tweak the
script if needed.
That's it!
Enjoy!
Ramón
--
View this message in context: http://n2.nabble.com/Some-ideas-LaTeX-on-iPad-iPhone-etc-tp4781323p4782400.html
Sent from the MacOSX-TeX mailing list archive at Nabble.com.
More information about the macostex-archives
mailing list