[TxMt] how to use html preview for LaTeX in TM1

3 views
Skip to first unread message

Piero D'Ancona

unread,
Dec 18, 2011, 10:12:41 AM12/18/11
to text...@lists.macromates.com
I'm confident this is a stupid question but I'm stymied, as someone would say.

I would like to experiment with using the feature
'pipe through command' of the html preview in TM1
in combination with pdflatex.

1) I created a folder /Users/piero/Desktop/prova

2) in the folder there's a trivial latex file prova.tex, which
compiles just fine producing a pdf of one page

3) I added a file script.sh which contains the following:

if /usr/texbin/pdflatex -output-directory /User/piero/Desktop/prova
-interaction=nonstopmode
/dev/stdin; then
echo '<meta http-equiv="refresh" content="0; tm-file:///tmp/stdin.pdf">'
fi

(this approach is suggested in Allan's blog. The script file
has been suitably chmodded)

4) in the html preview window of TM I checked the button
'Pipe text through' and added the path to
/Users/piero/Desktop/prova/script.sh

5) But, when I invoke web preview, the html window shows only

This is pdfTeX, Version 3.1415926-2.3-1.40.12 (TeX Live 2011)
restricted \write18 enabled.
entering extended mode ! I can't write on file `stdin.log'. (Press
Enter to retry, or Control-D
to exit; default file extension is `.log') Please type another
transcript file
name ! Emergency stop ! ==> Fatal error occurred, no output PDF file
produced!


What am I doing wrong? is this some permission issue in Lion
10.7.2 which I'm using?

Bonus question: in view of TM2 (thanks Allan - never lost the
faith), am I just wasting time since the feature will not work
in the future?

Thanks for help
Piero

_______________________________________________
textmate mailing list
text...@lists.macromates.com
http://lists.macromates.com/listinfo/textmate

Piero D'Ancona

unread,
Dec 18, 2011, 11:15:52 AM12/18/11
to text...@lists.macromates.com
PS misprint: the content of the script.sh file is

if /usr/texbin/pdflatex -output-directory /User/piero/Desktop/prova
-interaction=nonstopmode /dev/stdin; then

echo '<meta http-equiv="refresh" content="0; tm-file:///User/piero/Desktop/prova/stdin.pdf">'
fi

(in my original post the path to the pdf file was incorrect)

Allan Odgaard

unread,
Dec 18, 2011, 1:27:45 PM12/18/11
to TextMate users
On 18 Dec 2011, at 16:12, Piero D'Ancona wrote:

> I would like to experiment with using the feature
> 'pipe through command' of the html preview in TM1
> in combination with pdflatex.

To the best of my knowledge, that is not possible (since you switch the WebView to display a PDF for the LaTeX rendering).

Piero D'Ancona

unread,
Dec 18, 2011, 2:20:33 PM12/18/11
to text...@lists.macromates.com
Allan Odgaard <mailinglist@...> writes:

>
> On 18 Dec 2011, at 16:12, Piero D'Ancona wrote:
>
> > I would like to experiment with using the feature
> > 'pipe through command' of the html preview in TM1
> > in combination with pdflatex.
>
> To the best of my knowledge, that is not possible (since you switch
> the WebView to display a PDF for the LaTeX rendering).
>

Thanks for your time Allan.

Well I run into a problem with stdin which I do not
understand.

I'm editing a very simple latex file.

If I pipe through the command cat /dev/stdin, web preview
gives me the correct result (I see in the preview the contents
of my file, on one line).

If I pipe through the command
pdflatex -output-directory /tmp -interaction=nonstopmode /dev/stdin
and then look into the log file, I find that tex was not able to
compile. The TeX error is "no legal \end found". This means
that somehow pdflatex could not access stdin I guess, but why?

Piero

Piero D'Ancona

unread,
Dec 18, 2011, 4:15:47 PM12/18/11
to text...@lists.macromates.com
So, this version works:

cat /dev/stdin > /tmp/stdin.tex
if pdflatex -output-directory /tmp -interaction=nonstopmode /tmp/stdin.tex; then
echo '<meta http-equiv="refresh" content="0; file:///tmp/stdin.pdf">'
fi

If you pipe through this script you get a live preview
of the pdf file every time you modify the document (no
need to save). For a one-page document it is quite nice.
Unfortunately, the live preview comes back to the beginning
after each compilation, which is less than convenient for
longer documents and essentially defeats the purpose.
If it were possible to let the view to stay on the same page
after each compilation, this would make a serious alternative
to other workflows (and self contained inside TM, to boot)

Reply all
Reply to author
Forward
0 new messages