Anzeige:
Ergebnis 1 bis 3 von 3

Thema: richtige preview für textmate

  1. #1
    superseks
    Gast

    richtige preview für textmate

    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 ) 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 '

    Compiling LaTeX…

    '

    # Check if we actually have a tex compiler
    require_cmd "$TEX" "You can either set the TM_LATEX_COMPILER variable to the full path of your LaTeX compiler (e.g. /opt/local/bin/pdflatex or set the PATH variable to include the path of pdflatex."


    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

  2. #2
    superseks
    Gast
    keiner ne Antwort?

  3. #3
    Mattes
    Gast


    Welch ewig langes Script!
    Also ich verwende die Textmate internen Sachen und komme soweit auch gut klar.
    Sofern du in der Header-Zeile ein Link zu Deiner Preambel stehen hast und "Apfel + R" drückst compiliert Textmate mit dem in den Preferences angegebenen.

    Wenn du dafür pdflatex nimmst, wird daraus ja ein PDF... erstaunlicherweise :-)
    In den Preferences kannste dann auch noch angeben, dass das PDF auch gleich im angegebenen Viewer geöffnet wird. Das mach ich allerdings nicht, weil ich zwecks Verweisen etc immer mehrere Durchläufe brauch ....


    Grüße
    Matthias

Lesezeichen

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein
  •