BBEdit iCloud LaTeX - How to compile the file?

333 views
Skip to first unread message

Marek Stepanek

unread,
Dec 1, 2017, 4:33:30 AM12/1/17
to bbe...@googlegroups.com

Hello All!


I am pretty new to iCloud. I was always refusing iCloud, because I did
not want to share any informations with an server in a country, which
claims other countries to respect "America First". But since I have to
share my calendar with a friend, I switched it on. Pretty cool all you
can do with it, specially if you have two computers.

I have a strange problem: with MacVim working on a LaTeX file from the
iCloud, I issue the command \ll and \ls the file is "compiled" and I see
the corresponding pdf in Preview. Trying to achieve the same with BBEit:

I go to the BBEdit Menu Edit -> Copy Path -> Copy full Path, then I go
to a worksheet, and enter the command and the path escaping the empty
spaces like for example:

pdflatex /Users/username/Library/Mobile\
Documents/com~apple~CloudDocs/poesie_literatur/jessenin03.tex

Then I hit <cmd> <enter> - Right? so far? I get an error. Apparently
BBEdit (?) can't cope with ~ in the file name:

This is pdfTeX, Version 3.14159265-2.6-1.40.18 (TeX Live 2017)
(preloaded format=pdflatex)
restricted \write18 enabled.
entering extended mode
! I can't find file `"/Users/username/Library/Mobile
Documents/com"'.
<to be read again>
\protect
<*> "/Users/username/Library/Mobile Documents/com~

apple~CloudDocs/poesie_litera...

(Press Enter to retry, or Control-D to exit)
Please type another input file name:

Control-D is not working. And the worksheet is waiting for an file path
and does not accept no commands anymore. Should I switch to the
Terminal? (Ah! I just see the same error in the Terminal. But the
Control-D is working at least)


Some help? Best greetings to all!


marek

Bruce Van Allen

unread,
Dec 1, 2017, 11:23:23 AM12/1/17
to bbe...@googlegroups.com
On 12/1/17 at 1:33 AM, ms...@podiuminternational.org (Marek
Stepanek) wrote:

>Control-D is not working. And the worksheet is waiting for an file path
>and does not accept no commands anymore. Should I switch to the
>Terminal? (Ah! I just see the same error in the Terminal. But the
>Control-D is working at least)

BBEdit worksheets are shell worksheets, so the error message
you're getting with the instruction to use Control-D is coming
from the shell, as you observed when you tried the same command
in a terminal.

In a BBEdit shell worksheet, you can cancel a process with
Command-dot (dot = period/full stop).

I'm unfamiliar with the use of tilde ('~') in file paths. Maybe
try com.apple.CloudDocs in that portion of the path?

HTH
--

- Bruce

_bruce__van_allen__santa_cruz__ca_

Marek Stepanek

unread,
Dec 1, 2017, 3:11:02 PM12/1/17
to bbe...@googlegroups.com
On 01.12.2017 17:23, Bruce Van Allen wrote:

>
> In a BBEdit shell worksheet, you can cancel a process with Command-dot
> (dot = period/full stop).
>
> I'm unfamiliar with the use of tilde ('~') in file paths. Maybe try
> com.apple.CloudDocs in that portion of the path?
>
> HTH


Thank you Bruce for this hint! Unfortunately your suggestion for the
path to the file on iCloud is not working.

Greetings

Tom Robinson

unread,
Dec 3, 2017, 3:13:19 PM12/3/17
to BBEdit Talk
It looks like pdfLaTex is mistreating the tilde in the pathname, see e.g.

https://tex.stackexchange.com/questions/183568/using-8-3-path-names-with-pdflatex

A workaround is to turn on iCloud Drive for Desktop & Documents folders, and store your file there, and you’ll have a standard path :]

Marek Stepanek

unread,
Dec 5, 2017, 1:48:24 AM12/5/17
to bbe...@googlegroups.com
On 03.12.2017 21:13, Tom Robinson wrote:

...

>
> A workaround is to turn on iCloud Drive for Desktop & Documents folders, and store your file there, and you’ll have a standard path :]
>
>


Thank you Tom!


I activated iCloud Drive already. From there I am opening the TeX-file.
Probably I did not understand, what you meant with "for Desktop &
Documents" ...

I installed the latex package for BBEdit from github.com
(https://github.com/nathangrigg/Latex.bbpackage), which is unfortunately
not supported any more. But the applescript "Typeset" seems to cope with
the path to a TeX.file on iCloud Drive (mind the line breaks):

-- by Nathan Grigg

on main()
set typeset_lib_file to path_to_contents() & "Resources/typeset-lib.scpt"
set typeset_lib to load script POSIX file typeset_lib_file
tell typeset_lib to typeset without synctex and gitinfo
end main


-- Catch and display custom errors; exit silently on cancelled dialogs
try
main()
on error eStr number eNum partial result rList from badObj to exptectedType
if eNum = 5033 then
display dialog eStr buttons {"OK"} with title "Error" default button 1
else if eNum = 5088 then
beep
else if eNum is not -128 then
error eStr number eNum partial result rList from badObj to exptectedType
end if
end try

on path_to_contents()
--- Returns path to "Contents" folder containing the current script
local delims, split_string
set delims to AppleScript's text item delimiters
set AppleScript's text item delimiters to "/Contents/"
set split_string to text items of POSIX path of (path to me)
set AppleScript's text item delimiters to delims
if length of split_string = 1 then error "This script must remain
inside the Latex BBEdit package because it depends on other scripts in
that package." number 5033
return (item 1 of split_string) & "/Contents/"
end path_to_contents


But the Preview of the script "Open pdf" is not working.

1. My question to this mailing list again: How to typeset
TeX-files on iCloud in BBEdit? Open the pdf with Preview
automaticly.

2. How to typeset in Terminal (Path!) the TeX-file from iCloud?
What is doing this Apple Script with the path to reproduce it
with the Terminal?

Finally I will stick with MacVim, if you are not suggesting a working
solution for BBEdit.


Best greetings



marek

Tom Robinson

unread,
Dec 5, 2017, 3:24:24 PM12/5/17
to bbe...@googlegroups.com
If you’ve turned on iCloud Desktop & Documents, and stored your files in ~/Documents, your path will look like /Users/tom/Documents/ping.sh, not the tilde filled version you have.

(At least with Sierra and High Sierra)

From a quick look, the link I supplied had workarounds for the pdfLaTex ‘bug’.

Cheers
Reply all
Reply to author
Forward
0 new messages