# want to customize LyX, make a copy of the file LYXDIR/lyxrc as
# ~/.lyx/lyxrc and edit this file instead. Any setting in lyxrc will
# override the values given here.
-\\Format text txt ASCII A
-\\Format textparagraph txt ASCII(paragraphs) ""
-\\Format docbook sgml DocBook B
+\\Format asciichess asc "ASCII (chess output)" ""
+\\Format asciiimage asc "ASCII (image)" ""
+\\Format asciixfig asc "ASCII (xfig output)" ""
+\\Format agr agr GRACE ""
\\Format bmp bmp BMP ""
+\\Format date "" "date command" ""
+\\Format dateout "" "date (output)" ""
+\\Format docbook sgml DocBook B
\\Format dvi dvi DVI D
\\Format eps eps EPS ""
\\Format fax "" Fax ""
+\\Format fen fen FEN ""
\\Format fig fig XFig ""
-\\Format agr agr GRACE ""
-\\Format html html HTML H
\\Format gif gif GIF ""
+\\Format html html HTML H
\\Format jpg jpg JPG ""
\\Format latex tex LaTeX L
\\Format linuxdoc sgml LinuxDoc x
\\Format lyx lyx LyX ""
+\\Format lyxpreview lyxpreview "LyX Preview" ""
\\Format literate nw NoWeb N
+\\Format pbm pbm PBM ""
\\Format pdf pdf PDF P
\\Format pdf2 pdf "PDF (pdflatex)" F
\\Format pdf3 pdf "PDF (dvipdfm)" m
+\\Format pdftex pdftex_t PDFTEX ""
+\\Format pgm pgm PGM ""
\\Format png png PNG ""
\\Format ppm ppm PPM ""
-\\Format pgm pgm PGM ""
-\\Format pbm pbm PBM ""
-\\Format ps ps Postscript t
\\Format program "" Program ""
+\\Format ps ps Postscript t
+\\Format pstex pstex_t PSTEX ""
+\\Format text txt ASCII A
+\\Format textparagraph txt ASCII(paragraphs) ""
\\Format tgif obj TGIF ""
\\Format tiff tif TIFF ""
\\Format word doc Word W
\\Format xbm xbm XBM ""
\\Format xpm xpm XPM ""
-\\Format lyxpreview lyxpreview "LyX Preview" ""
-\\converter latex dvi "$latex_to_dvi" "latex"
-\\converter latex pdf2 "$latex_to_pdf" "latex"
-\\converter latex html "$latex_to_html_command" "originaldir,needaux"
-\\converter literate latex "$literate_to_tex_command" ""
+\\converter date dateout "date +%d-%m-%Y > \$\$o" ""
+\\converter docbook dvi "$docbook_to_dvi_command" ""
+\\converter docbook html "$docbook_to_html_command" ""
\\converter dvi pdf3 "$dvi_to_pdf_command" ""
\\converter dvi ps "$dvi_to_ps_command" ""
-\\converter ps pdf "$ps_to_pdf_command" ""
-\\converter ps fax "$fax_command" ""
-\\converter linuxdoc lyx "$linuxdoc_to_lyx_command" ""
-\\converter linuxdoc latex "$linuxdoc_to_latex_command" ""
+\\converter fen asciichess "python \$\$s/fen2ascii.py \$\$i \$\$o" ""
+\\converter fig pdftex "sh \$\$s/fig2pdftex.sh \$\$i \$\$o" ""
+\\converter fig pstex "sh \$\$s/fig2pstex.sh \$\$i \$\$o" ""
+\\converter html latex "$html_to_latex_command" ""
+\\converter latex html "$latex_to_html_command" "originaldir,needaux"
+\\converter latex dvi "$latex_to_dvi" "latex"
+\\converter latex lyx "$tex_to_lyx_command" ""
+\\converter latex pdf2 "$latex_to_pdf" "latex"
\\converter linuxdoc dvi "$linuxdoc_to_dvi_command" ""
\\converter linuxdoc html "$linuxdoc_to_html_command" ""
-\\converter docbook dvi "$docbook_to_dvi_command" ""
-\\converter docbook html "$docbook_to_html_command" ""
-\\converter lyxpreview ppm "$lyxpreview_to_bitmap_command" ""
-
-\\converter latex lyx "$tex_to_lyx_command" ""
+\\converter linuxdoc latex "$linuxdoc_to_latex_command" ""
+\\converter linuxdoc lyx "$linuxdoc_to_lyx_command" ""
+\\converter literate latex "$literate_to_tex_command" ""
\\converter literate lyx "$literate_to_lyx_command" ""
-\\converter html latex "$html_to_latex_command" ""
+\\converter lyxpreview ppm "$lyxpreview_to_bitmap_command" ""
+\\converter ps fax "$fax_command" ""
+\\converter ps pdf "$ps_to_pdf_command" ""
\\converter word latex "$word_to_latex_command" ""
\\viewer dvi "$DVI_VIEWER"
\\viewer html "$HTML_VIEWER"
\\viewer pdf "$PDF_VIEWER"
+\\viewer pdf2 "$PDF_VIEWER"
+\\viewer pdf3 "$PDF_VIEWER"
\\viewer ps "$GHOSTVIEW -swap"
\\viewer eps "$GHOSTVIEW"
cat >>$outfile <<EOF
\\converter fig eps "fig2dev -L eps \$\$i \$\$o" ""
\\converter fig ppm "fig2dev -L ppm \$\$i \$\$o" ""
+\\converter fig png "fig2dev -L png \$\$i \$\$o" ""
EOF
fi
# a PDF file ${base}.pdf and place the text in a LaTeX file
# ${base}.pdftex_t for typesetting by pdflatex itself.
modern_xfig() {
- input=$1.fig
- pdftex=$1.pdf
- pdftex_t=$1.pdftex_t
+ echo modern_xfig
+
+ # Can we find fig2dev?
+ type fig2dev > /dev/null || exit 1
+
+ input=$1
+ pdftex_t=$2
+ pdftex=$3.pdf
fig2dev -Lpdftex ${input} ${pdftex}
- fig2dev -Lpdftex_t -p$1 ${input} ${pdftex_t}
+ fig2dev -Lpdftex_t -p${outbase} ${input} ${pdftex_t}
exit 0;
}
# Older versions of xfig cannot do this, so we emulate the behaviour using
# pstex and pstex_t output.
legacy_xfig() {
- input=$1.fig
- pstex=$1.pstex
- png=$1.png
- pdftex_t=$1.pdftex_t
+ echo legacy_xfig
+
+ # Can we find fig2dev, eps2eos or gs?
+ type fig2dev > /dev/null || exit 1
+ type eps2eps > /dev/null || exit 1
+ type gs > /dev/null || exit 1
+
+ input=$1
+ pdftex_t=$2
+ png=$3.png
+ pstex=$3.pstex
fig2dev -Lpstex ${input} ${pstex}
- fig2dev -Lpstex_t -p$1 ${input} ${pdftex_t}
+ fig2dev -Lpstex_t -p${outbase} ${input} ${pdftex_t}
# Convert the ${pstex} EPS file (free of "special" text) to PDF format
# using gs.
# The main logic of the script is below.
# All it does is ascertain which of the two functions above to call.
-# We expect a single arg, the name of the input file.
-test $# -eq 1 || exit 1
+# We expect two args, the names of the input and output files.
+test $# -eq 2 || exit 1
+
+input=$1
+output=$2
-# Remove the .fig extension
-input=`basename $1`
-base=`echo ${input} | sed 's/\.fig$//'`
+# Strip the extension from ${output}
+outbase=`echo ${output} | sed 's/[.][^.]*$//'`
# Ascertain whether fig2dev is "modern enough".
# Here "modern" means "fig2dev Version 3.2 Patchlevel 4"
version_info=`fig2dev -h | sed '/^fig2dev/! d'`
# If no line begins "fig2dev" then default to legacy_xfig
-test "x${version_info}" = "x" && legacy_xfig ${base}
+test "x${version_info}" = "x" && {
+ legacy_xfig ${input} ${output} ${outbase}
+}
version=`echo ${version_info} | cut -d' ' -f3`
patchlevel=`echo ${version_info} | cut -d' ' -f5`
# If we cannot extract the version of patchlevel info
# then default to legacy_xfig
-test "x${version}" = "x" -o "x${patchlevel}" = "x" && legacy_xfig ${base}
-echo ${version} ${patchlevel} | grep '[0-9]!' -o && legacy_xfig ${base}
+test "x${version}" = "x" -o "x${patchlevel}" = "x" && {
+ legacy_xfig ${input} ${output} ${outbase}
+}
+echo ${version} ${patchlevel} | grep '[0-9]!' -o && {
+ legacy_xfig ${input} ${output} ${outbase}
+}
-# So, is it am old version?
-test ${version} != "3.2" -o ${patchlevel} -lt 4 && legacy_xfig ${base}
+# So, is it an old version?
+test ${version} != "3.2" -o ${patchlevel} -lt 4 && {
+ legacy_xfig ${input} ${output} ${outbase}
+}
# I guess not ;-)
-modern_xfig ${base}
+
+# Commented out for now to test legacy_xfig...
+#modern_xfig ${input} ${output} ${outbase}
+legacy_xfig ${input} ${output} ${outbase}
# The end
--- /dev/null
+#! /bin/sh
+
+# file fig2pstex.sh
+# This file is part of LyX, the document processor.
+# Licence details can be found in the file COPYING.
+#
+# author Angus Leeming
+#
+# Full author contact details are available in file CREDITS
+
+
+# This script converts an XFIG image to something that latex can process
+# into high quality PostScript.
+
+# Usage: sh fig2pstex.sh ${input} ${output}
+# to generate the pstex_t file ${output}.
+# In turn this file will \includegraphics{${output_base}}.
+# The necessary ${output_base}.eps is also generated by this script.
+#
+# Thereafter, you need only '\input{${output}}' in your latex document.
+
+# We expect two args, the names of the input and output files.
+test $# -eq 2 || exit 1
+
+# Can we find fig2dev?
+type fig2dev > /dev/null || exit 1
+
+input=$1
+output=$2
+
+# Strip the extension from ${output}
+outbase=`echo ${output} | sed 's/[.][^.]*$//'`
+
+# Generate the EPS file
+outeps=${outbase}.eps
+fig2dev -Lpstex ${input} ${outeps}
+
+# Generate the PSTEX_T file
+fig2dev -Lpstex_t -p${outbase} ${input} ${output}
+
+# The end