[TxMt] Re: How to use TM/TM2 as an external editor to TeXShop?

René Schwaiger sanssecours at f-m.fm
Mon Jul 20 15:49:10 UTC 2015

Hi Martin,

> On 19 Jul 2015, at 16:26 , Martin Wilhelm Leidig <listwatch at moss.in-berlin.de> wrote:
> Hi *,
> I’d like to use TM and TM2 (or at least one of them) with my custom TeXShop engines.  By  including a shebang-like line in the first line of the input, e.g.,
>> ---
>> %!TEX TS-program = pdflatex
>> ---
> one tells TM to use pdflatex; but there is no way to tell it to use, say, my ho-dtxmk engine (which processes DTX files using Heiko Oberdiek’s (ho) extracting/documentation wizardry).
> So, is there a way to have TM[2] run TeXShop as the typesetting engine when I push Cmd-R instead of running the tex binaries directly, thus functioning as the external editor in TeXShop?

yes. Just use the following bash code to tell “TeXShop” to typeset the current active file in TextMate:


filename=`basename "${TM_FILEPATH}"`
osascript <<EOF
  tell document "$filename" of application "TeXShop" to typesetinteractive

This code assumes that you already opened the file with “Open for Preview” in TeXShop beforehand! If you ticked the option “Configure for External Editor” in “TeXShop” then just use “Open” instead of “Open for Preview”.

I attached a bundle that contains a command that contains above code. Just double click the bundle to install it. After that:

1. Open the file you want to typeset in “TeXShop” as described above
2. Open the same file in TextMate
3. Hit `⌘R` to typeset the file with “TeXShop”

> Regards from Ladenburg,
> -MWL-
> -- 
> Martin Wilhelm Leidig, SatzTeXnik — Dante e.V. #1580
> Professional TeXing and TeXnical counselling

Kind regards,

-------------- next part --------------
A non-text attachment was scrubbed...
Name: MWL.tmbundle.zip
Type: application/zip
Size: 2553 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate/attachments/20150720/95c36f7d/attachment.zip>

More information about the textmate mailing list