Hey there,

It’s been 15 years since I did this, but my recollection I built a Makefile 
to do this.

BASE_NAME = MyLaTeXDoc
TEX_SOURCE = $(BASE_NAME).tex
BIBTEX_SOURCE = $(BASE_NAME).bib

RESOURCES = 

INTERMEDIATE_FILES = $(BASE_NAME).aux $(BASE_NAME).log $(BASE_NAME).log 
$(BASE_NAME).bbl $(BASE_NAME).blg
PRODUCT = $(BASE_NAME).pdf
compile: $(TEX_SOURCE) $(RESOURCES) bibtexFile 
    pdflatex $(TEX_SOURCE)
    pdflatex $(TEX_SOURCE)

bibtexFile: $(BIBTEX_SOURCE) auxFile
    bibtex $(BASE_NAME)

auxFile: $(TEX_SOURCE)
    pdflatex $(TEX_SOURCE)

preview: $(PRODUCT)
    open $(PRODUCT)

.PHONY: clean
clean:
    rm -f $(INTERMEDIATE_FILES) $(PRODUCT)

Then I wrote several simple scripts that would run the different Make 
targets (Compile LaTeX, Preview LaTeX, etc.), which I would launch from the 
Scripts palette.

Like I said, it’s been ages since I did this, but it worked pretty well for 
me.

-Prachi

On Sunday, January 22, 2023 at 5:51:09 PM UTC-5 Maarten Sneep wrote:

> Hi,
>
> > On 22 Jan 2023, at 23:18, Andrew J <[email protected]> wrote:
> > 
> > Dear all,
> > 
> > I have been using BBEdit on and off for many years, but I've never been 
> satisfied with its use with LaTeX projects. Many other editing environments 
> (emacs, TextMate, VS Code) have well-supported packages for editing tex 
> files as well as running various latex engines and dealing with the output. 
> > 
> > I understand that BBEdit does not want to be an IDE, but this use case 
> seems pretty straightforward. Indeed, there have been various attempts 
> through the years at making an environment like this through BBEdit's 
> scripting capabilities. 
> > 
> > I note that many such attempts, including this fairly recent one, use a 
> separate terminal process to actually run the latex compiler. Is this 
> considered best practice? It seems to ignore things that BBEdit can do 
> which give ideas for other options:
> > • 
> > capture stdout as the result of the do shell script AppleScript and 
> display in a new untitled window. This is actually straightforward, 
> although I wish I could figure out how to deal with naming windows and 
> possibly not requiring them to be saved.
> > • populate a shell worksheet and run it automatically. I can't quite 
> figure this out -- I've seem some pointers to actually getting the text 
> into a worksheet, but I can't work out running a shell command in a shell 
> worksheet from AppleScript.
> > So: are either of these considered the standard method for this sort of 
> thing -- and is there a standard method, or do most people just keep a 
> terminal window open and do everything by hand?
> > 
> > Any other ideas? Obviously even more advanced stuff like parsing error 
> output, etc. (which is possible in most of the aforementioned IDE-like 
> editors) would be a bonus. I'd really like to move more of my work over to 
> BBEdit....
>
>
> I wrote a solution some 20 years ago in AppleScript, using the terminal to 
> do the heavy lifting. This saves you from a ton of configuration issues, as 
> most instructions to get LaTeX working focus on the terminal. In fact most 
> of the scripting is in a shell script that gets called from AppleScript (I 
> strongly dislike AppleScript, it seems that I never get it to behave 
> exactly as I’d like to have it. 
>
> I would not advise to use a worksheet. It will save the output of the 
> latex run, and that is certainly now what you want. Also the behaviour is 
> not exactly what you want when you encounter tex errors. The interaction 
> with terminal windows is in my experience less cumbersome than avoiding the 
> terminal. A variant of the title of a Stanley Kubric movie suddenly floats 
> to the top of my head: "Dr. Strangelove or: How I Learned to Stop Worrying 
> and Love the Terminal".
>
> My tooling is still available on https://msneep.home.xs4all.nl/latex/ I 
> can no longer update it as my ISP made some changes to the overall setup, 
> so if updates are required someone else will have to take over the 
> maintenance. From the title you can figure out how old it is, TextWrangler 
> is absorbed into BBEdit, so a lot of the text no longer applies. The BBEdit 
> version of all scripts still work fine though. Feel free to use this as a 
> starting point. 
>
> Kind regards,
>
> Maarten Sneep

-- 
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/5cd46d7d-3b2d-4ae4-b21e-254119075953n%40googlegroups.com.

Reply via email to