In addition to what Patrick mentioned, I’ll add: I don’t think pdflatex is happy writing its output to stdout, or reading from stdin. You might have to write your latex code to a temporary file, call pdflatex, and then open the output file that pdflatex created and send that to stdout.

A simple script to do this would be:

```sh
#!/bin/sh

cat > tmp.latex # safe stdin (from bbedit) to a file
pdflatex tmp.latex >/dev/null # throw away pdflatex’s stdout
cat tmp.pdf # send generated pdf file to stdout (back to bbedit)
```

But the bigger problem is: I don’t think BBEdit can accept PDF data from a preview filter. It wants HTML. It might be possible to embed the PDF output in HTML, but I don’t know how to do that.

Personally I’d just use Skim to view the PDF output. It has an auto-reload function.

Hope this helps.
-sam

On 22 Jan 2020, at 14:52, Patrick Woolsey wrote:

On 1/21/20 at 3:32 PM, [email protected] (Christopher Finazzo) wrote:

Oh. So. Close.

I can write a shell script that contains this line and make it execute but locating the pdftex executable in a way that TeX expects does not work. The preview window displays the console output of trying to run this against my input file.

#!/Library/TeX/texbin/pdflatex

pdflatex

I regret it's hard for me to usefully comment here since I'm not familiar with your specific workflow; however, here's what BBEdit expects from a preview filter. Cribbing from page 260 of the current manual:

Creating and Using Preview Filters

Preview filters may consist of any of these three types:

* An AppleScript, with an entry point named "FilterTextForBBEditPreview".
    This entry point will receive a 'unicode text' object which is the
document's contents. If there is no "FilterTextForBBEditPreview" entry point, the script's run handler will be called with the text. The script
    should return a 'unicode text' result.

* A Unix executable or a symlink to any such item. (For example, a copy
    of the 'multimarkdown' binary.)

  * A Unix script; for example, a Perl, Python, Ruby, or shell script.
    (Any such script should contain a [ valid :-) ] shebang line.)

    Both Unix scripts and Unix executables will receive the document's
    contents as UTF-8 text on STDIN and should **return UTF-8 text
(ordinarily, in the form of an HTML document) to STDOUT**. BBEdit will
    then display that output in the Preview window.

so though you could also have your preview filter generate a PDF and open that in Preview.app, these actions would necessarily be external to BBEdit.

[PS: In place of your above, I would try a normal shell shebang line and specify the full path to the desired binary in your script, e.g.
====
#!/bin/sh
/Library/TeX/texbin/pdflatex
====
and if that doesn't help, then please drop a note to support with more details and we'll be happy to take a look.]

--
This is the BBEdit Talk public discussion group. If you have a feature request or need technical support, please email "[email protected]" rather than posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit> --- You received this message because you are subscribed to the Google Groups "BBEdit Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/bbedit/r480Ps-10146i-FBD1DE25A7B649DBA4FE0F9CF5BC7A3C%40Cylinder.local.

--
This is the BBEdit Talk public discussion group. If you have a feature request or need 
technical support, please email "[email protected]" rather than posting here. 
Follow @bbedit on Twitter: <https://twitter.com/bbedit>
--- You received this message because you are subscribed to the Google Groups "BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/134A3AA4-D982-4074-86FB-A26D5E45077B%40munkynet.org.

Reply via email to