Am 19.04.2016 um 17:42 schrieb Anders Host-Madsen <[email protected]>:
>
> Anders Host-Madsen <ahostmadsen <at> yahoo.com> writes:
>
> A few more comment on this. To get the same latex file as one would
> get when exporting from the menu, set the "nice" flag in the exporter.
>
> The main issue with the script approach is that it changes the name
> of the files. For example, spaces become _. I don't see how to solve
> this. I doesn't seem the real name of the original file is available
> to the converter.
This is possible with a little bit more effort.
1. Add "$$f“ as 3rd parameter for your converter call in LyX preferences.
2. Extend your script similar to the following modified version:
===============
#!/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
if [ -n "$3" ]; then
targetname=$(basename "$3" .lyx)
else
targetname="$(filename)"
fi
echo pwd=$(pwd) filename="$filename"
echo pdflatex "$1" "$targetdir"/"$targetname".pdf
pdflatex "$1" && test -f "$filename".pdf && cp "$filename".pdf
"$targetdir"/"$targetname".pdf
echo cp "$1" "$targetdir"/"$targetname".tex
cp "$1" "$targetdir"/"$targetname".tex
===============
The point is to check for an (optional) 3rd argument to set the targetname like
the LyX source file name.
Stephan