superseks
03-04-2008, 23:54
hallo zusammen,
habe nur textmate auf meinem MB und versuche mich weiter damit an LaTeX. (Hatte vorher TexShop benutzt). Ich finde Textmate sehr gut und würde es gerne weiter verwenden. Nun habe ich das Problem dass mein Compiler in Textmate zwar das Dokument verarbeitet aber nicht direkt anzeigt. ich muss die PDF-Datei extra öffnen. Das nervt ganz schön. Weiß jemand Rat ob ich vllt einen anderen Viewer nehmen soll oder an dem Befehl Typeset&View verändern soll. Hier ist mal der Befehl:
# Source some support functions we need.
. "${TM_SUPPORT_PATH}/lib/html.sh"
. "${TM_SUPPORT_PATH}/lib/webpreview.sh"
# Get the viewer program. Any program (that works with open -a <name>) can be used,
# except 'html' which is reserved to mean the internal HTML window. This is also the
# default option.
V=${TM_LATEX_VIEWER:-html}
EL=${TM_LATEX_ERRLVL:-1}
M=${TM_LATEX_MASTER:-$TM_FILEPATH}
DIR=`dirname "$M"`
FILE=`basename "$M"`
PDF="${FILE%.*}.pdf"
DVI="${FILE%.*}.dvi"
PS="${FILE%.*}.ps"
CWD="`pwd`/"
# Set up TeX compiler, fallback to xelatex if document indicates it,
if grep -Esq '\\usepackage{.*(xunicode|fontspec)|program=xelate x' "$M"
then DEF_TEX=xelatex
# or to latex+dvi2ps if pstricks is there
elif grep -Esq '\\usepackage{.*pstricks}' "$M"
then DEF_TEX=latex
TEX_PSTRICKS=1
else DEF_TEX=pdflatex
fi
TEX=${TM_LATEX_COMPILER:-$DEF_TEX}
# Add our tex directory to the TEXINPUTS variable so e.g. pdfsync is found (even when the user hasn’t installed it)
export TEXINPUTS="$TM_BUNDLE_SUPPORT/tex//:$(kpsewhich -progname "$TEX" --expand-var '$TEXINPUTS')"
# Switch to the right directory.
cd "$TM_PROJECT_DIRECTORY"
cd "$DIR"
# Prepare output window.
html_header 'Typeset & View' "$FILE"
echo '<h2>Compiling LaTeX…</h2>'
# Check if we actually have a tex compiler
require_cmd "$TEX" "You can either set the <tt>TM_LATEX_COMPILER</tt> variable to the full path of your LaTeX compiler (e.g. <tt>/opt/local/bin/pdflatex</tt> or set the <tt>PATH</tt> variable to include the path of <tt>pdflatex</tt>."
run_tex () {
if [ "$TEX" != latexmk.pl ]
then "$TEX" ${TM_LATEX_OPTIONS:=-interaction=nonstopmode -file-line-error-style} "$1"
else "$TEX" -f -r "${TM_BUNDLE_SUPPORT}/latexmkrc" "$1"
fi
}
# Compile.
run_tex "$FILE" 2>&1| latexErrWarnHtml.py -v
RC=$?
if [[ $TEX_PSTRICKS ]]; then
dvips "$DVI" -o "$PS" && ps2pdf "$PS"
fi
# If there is output and it's newer than the current document, then we go directly to preview or link to it.
if [ -s "${PDF}" -a "$PDF" -nt "$FILE" ]; then
if [[ "$V" == html ]]; then
WEB_LOC="tm-file://${DIR}/${PDF}"
WEB_LOC="${WEB_LOC//\\#/%23}"
if (($RC > $EL))
then link "${WEB_LOC}" 'Click Here to Preview'
else redirect "${WEB_LOC}"
fi
else
V=${V%.app} # strip potential .app extension
if find_app >/dev/null "$V.app"; then
open -a "$V" "$PDF"
if [[ "$V" == TeXniscope && -f "${PDF}sync" ]]; then
SCRIPT=$(find_app TeXniscope.app)/Contents/Resources/forward-search.sh
[[ -x "$SCRIPT" ]] && "$SCRIPT" "$TM_LINE_NUMBER" "$TM_FILEPATH" "$PDF"
fi
if (($RC <= $EL)); then exit_discard; fi
else
strong "Error locating external viewer: $V"
fi
fi
else
strong "Error: PDF file not written to disk"
fi
html_footer
als Input hab ich none
als output show as HTML
und text.tex.latex bei scope selector
bei save hab ich all files in project
Hoffe ihr könnt mir da helfen
gruß superseks
habe nur textmate auf meinem MB und versuche mich weiter damit an LaTeX. (Hatte vorher TexShop benutzt). Ich finde Textmate sehr gut und würde es gerne weiter verwenden. Nun habe ich das Problem dass mein Compiler in Textmate zwar das Dokument verarbeitet aber nicht direkt anzeigt. ich muss die PDF-Datei extra öffnen. Das nervt ganz schön. Weiß jemand Rat ob ich vllt einen anderen Viewer nehmen soll oder an dem Befehl Typeset&View verändern soll. Hier ist mal der Befehl:
# Source some support functions we need.
. "${TM_SUPPORT_PATH}/lib/html.sh"
. "${TM_SUPPORT_PATH}/lib/webpreview.sh"
# Get the viewer program. Any program (that works with open -a <name>) can be used,
# except 'html' which is reserved to mean the internal HTML window. This is also the
# default option.
V=${TM_LATEX_VIEWER:-html}
EL=${TM_LATEX_ERRLVL:-1}
M=${TM_LATEX_MASTER:-$TM_FILEPATH}
DIR=`dirname "$M"`
FILE=`basename "$M"`
PDF="${FILE%.*}.pdf"
DVI="${FILE%.*}.dvi"
PS="${FILE%.*}.ps"
CWD="`pwd`/"
# Set up TeX compiler, fallback to xelatex if document indicates it,
if grep -Esq '\\usepackage{.*(xunicode|fontspec)|program=xelate x' "$M"
then DEF_TEX=xelatex
# or to latex+dvi2ps if pstricks is there
elif grep -Esq '\\usepackage{.*pstricks}' "$M"
then DEF_TEX=latex
TEX_PSTRICKS=1
else DEF_TEX=pdflatex
fi
TEX=${TM_LATEX_COMPILER:-$DEF_TEX}
# Add our tex directory to the TEXINPUTS variable so e.g. pdfsync is found (even when the user hasn’t installed it)
export TEXINPUTS="$TM_BUNDLE_SUPPORT/tex//:$(kpsewhich -progname "$TEX" --expand-var '$TEXINPUTS')"
# Switch to the right directory.
cd "$TM_PROJECT_DIRECTORY"
cd "$DIR"
# Prepare output window.
html_header 'Typeset & View' "$FILE"
echo '<h2>Compiling LaTeX…</h2>'
# Check if we actually have a tex compiler
require_cmd "$TEX" "You can either set the <tt>TM_LATEX_COMPILER</tt> variable to the full path of your LaTeX compiler (e.g. <tt>/opt/local/bin/pdflatex</tt> or set the <tt>PATH</tt> variable to include the path of <tt>pdflatex</tt>."
run_tex () {
if [ "$TEX" != latexmk.pl ]
then "$TEX" ${TM_LATEX_OPTIONS:=-interaction=nonstopmode -file-line-error-style} "$1"
else "$TEX" -f -r "${TM_BUNDLE_SUPPORT}/latexmkrc" "$1"
fi
}
# Compile.
run_tex "$FILE" 2>&1| latexErrWarnHtml.py -v
RC=$?
if [[ $TEX_PSTRICKS ]]; then
dvips "$DVI" -o "$PS" && ps2pdf "$PS"
fi
# If there is output and it's newer than the current document, then we go directly to preview or link to it.
if [ -s "${PDF}" -a "$PDF" -nt "$FILE" ]; then
if [[ "$V" == html ]]; then
WEB_LOC="tm-file://${DIR}/${PDF}"
WEB_LOC="${WEB_LOC//\\#/%23}"
if (($RC > $EL))
then link "${WEB_LOC}" 'Click Here to Preview'
else redirect "${WEB_LOC}"
fi
else
V=${V%.app} # strip potential .app extension
if find_app >/dev/null "$V.app"; then
open -a "$V" "$PDF"
if [[ "$V" == TeXniscope && -f "${PDF}sync" ]]; then
SCRIPT=$(find_app TeXniscope.app)/Contents/Resources/forward-search.sh
[[ -x "$SCRIPT" ]] && "$SCRIPT" "$TM_LINE_NUMBER" "$TM_FILEPATH" "$PDF"
fi
if (($RC <= $EL)); then exit_discard; fi
else
strong "Error locating external viewer: $V"
fi
fi
else
strong "Error: PDF file not written to disk"
fi
html_footer
als Input hab ich none
als output show as HTML
und text.tex.latex bei scope selector
bei save hab ich all files in project
Hoffe ihr könnt mir da helfen
gruß superseks