Jeanluca Scaljeri
Jeanluca Scaljeri

Reputation: 29129

process a file remotely using ssh

I have this report.tex file which I convert to pdf as follows:

latex report.tex
dvips report.dvi -o report.ps
ps2pdfwr report.ps report.pdf

These commands are placed in a file called linux_build

This works great. However, this works on my Linux machine and most of my work I do on my Mac

I checked out MacTex which is enormous (> 4GB) so I decided to process the latex file remotely (so working on my Mac, and building on my Linux computer). Like this:

ssh [email protected] "cd build && ./linux_build" < report.tex
scp [email protected]:build/report.pdf .

All this works, except for one thing:

latex report.tex

That command simply looks on disk, not for some input stream/pipe of whatever. It is at this point I'm not sure anymore how to fix this. Any suggestions ?

Upvotes: 1

Views: 898

Answers (3)

Ingo Blechschmidt
Ingo Blechschmidt

Reputation: 1589

I know your frustration. It grew so big that I put together a small script which efficiently runs LaTeX on a remote server.

It prestarts LaTeX on the remote end with the preamble of the previous run such that LaTeX has already loaded the required packages and is ready to go when changed contents arrives, and starts streaming the resulting PDF file immediately (before LaTeX has finished writing to it). Also dependencies (images, included source files etc.) are transparently handled.

Maybe you too find it useful: https://github.com/iblech/sshlatex

No installation is necessary. Execution is simple:

$ sshlatex ssh.example.org foo.tex

Upvotes: 2

Etan Reisner
Etan Reisner

Reputation: 80931

If latex supports reading from standard input then you can do it that way.

Possibly just latex or maybe latex - or possibly latex /dev/stdin to fake it as a local file.

If that doesn't work then you need to transfer the file over first.

Upvotes: 0

jim mcnamara
jim mcnamara

Reputation: 16389

scp report.tex [email protected]:/home/Jeanluca/build
ssh [email protected] "cd build && ./linux_build" < report.tex
scp [email protected]:build/report.pdf 

Try sending your tex file over first. To the full path for the build directory.

Upvotes: 2

Related Questions