Am 13.04.2016 um 23:55 schrieb Anders Host-Madsen <ahostmad...@yahoo.com>: > > Paul A. Rubin <rubin <at> msu.edu> writes: > >> Is LExport.sh marked executable by all users, not just yourself. I don't >> know whether LyX runs the script with you as the user or with LyX as the >> user. > > It should be. Here is ls -l > > -rwxrwxrwx@ 1 madsen admin 20 Apr 12 14:11 LExport.sh > >> >> Also, does the script specify a command interpreter with a hash-bang comment >> at the top? In other words, when you successfully run it outside LyX, do you >> do so with "./LExport.sh", or do you specify a command interpreter (e.g, >> "bash ./LExport.sh"? > > Yes. Here is the script (at the moment I'm just trying to make the script run, > so it doesn't do anything yet): > > #!/bin/bash > cp $1 $2 > > Perhaps it's some security issue on Mac that prevents it from running? > > Anyway, now that I know there is a message pane, I figured out exactly > where it goes wrong with the command-sequence. The issue is with copying > figures. Sometimes they don't copy, and pdflatex fails. If I have a > long LyX document, but without figures, the command-sequence seems > to always work, producing a latex and pdf file.
This is working for me: 1. Create a script in "$HOME"/bin named iPadConvert.sh 1a) mkdir -p "$HOME"/bin 1b) vi "$HOME"/bin/iPadConvert.sh ======================================= #!/bin/sh exec >> "$HOME"/bin/iPadConvert.log echo $(date)":" "$0" "$@" filename=$(basename "$1" .tex) if [ -d "$2" ]; then targetdir="$2" elif [ -f "$2" ]; then targetdir=$(dirname "$2") else targetdir="$2" if [ ! -d "$2" ]; then echo Bad call with target "$2" exit 1 fi fi echo pwd=$(pwd) filename="$filename" echo pdflatex "$1" "$targetdir"/"$filename".pdf pdflatex "$1" && test -f "$filename".pdf && cp "$filename".pdf "$targetdir"/ echo cp "$1" "$targetdir"/"$filename".tex cp "$1" "$targetdir"/"$filename".tex ======================================= 1c) chmod +x "$HOME"/bin/iPadConvert.sh 2. Add $HOME/bin to PATH settings of LyX (at end with colon separator) => Preferences => Path e.g. /Library/TeX/texbin:/opt/local/teTeX/bin:/opt/local/bin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:$HOME/bin 3. Add file format and converter ====================================== \format "ipad" "" "iPad" "" "auto" "" "" „" \converter "pdflatex" "ipad" "iPadConvert.sh $$i $$r" "" ====================================== 4. Export to iPad => "$HOME"/bin/iPadConvert.log contains e.g. ====================================== Fri Apr 15 09:00:41 CEST 2016: /Users/stephan/bin/iPadConvert.sh newfile4.tex /Users/stephan/Documents/ pwd=/private/var/folders/1x/zm63s22x7s591xrlgm4rl9v40000gn/T/lyx_tmpdir.HyRSsWW90987/lyx_tmpbuf0 filename=newfile4 pdflatex newfile4.tex /Users/stephan/Documents//newfile4.pdf This is pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015) (preloaded format=pdflatex) restricted \write18 enabled. entering extended mode (./newfile4.tex LaTeX2e <2015/01/01> Babel <3.9l> and hyphenation patterns for 79 languages loaded. cp newfile4.tex /Users/stephan/Documents//newfile4.tex ====================================== BTW, you don’t need to save the document to get the updated .tex and .pdf files... The culprit is: you need to add the location of your script to LyX’s path setting! HTH and regards, Stephan