Menu

quick preview and user defined commands

kile
Nallam
2008-11-18
2012-07-03
  • Nallam

    Nallam - 2008-11-18

    Hi everybody,

    One of the features I find most useful in Kile is the quick preview of a selection, to see the result of some paragraph or formula without generating the whole doc. But I can't make it run with user defined commands if they are not defined INSIDE the selection.

    I usually define my own commands in the beginning of the document, with newcommand:
    \newcommand {\needref} {[\textcolor{red}{REF!}]}

    Then, if I select a piece of text that uses these commands and select Build>quickpreview>selection, the following error appears:

    [PreviewPDFLaTeX] preview.tex => preview.pdf (pdflatex)
    [PreviewPDFLaTeX] finished with exit status 1
    ./foo.tex:146:Undefined control sequence. \needref
    [PreviewPDFLaTeX] 1 error, 0 warnings, 0 badboxes

    Don't know if it is possible to make this work, or if I'm asking too much, but it would be great if quickpreview could know the user defined commands and generate the preview.

    Any ideas?

    Thnx

    Nallam

     
    • Nallam

      Nallam - 2008-11-19

      PERFECT. That did the trick. Believe it or not, I'd never tried that. Sometimes the answer is right in front of you and you don't notice it.

      Thanks so much!

       
    • Thomas Braun

      Thomas Braun - 2008-11-18

      Hi,

      your kile version?
      It is supposed to work so please also give a small testcase.

      Thomas

       
      • Nallam

        Nallam - 2008-11-19

        Thanks for the interest.
        I'm using kile 2.0.0
        Here's a little example:


        \documentclass [a4paper, 10pt] {article}

        \usepackage {color}

        \begin{document}

        \newcommand {\needref} {[\textcolor{red}{REF!}] }
        \newcommand {\xvspace}[1]{\rule{0pt}{#1}}

        \title{Title title title}
        \author{ Me, myself and I }
        \date{}
        \maketitle

        \section{Introduction}\label{Sec:Introduction}

        Intro intro intro intro intro intro intro intro \needref intro intro intro intro intro intro.
        
        \xvspace{7ex} More more more more more more more.
        

        \end{document}


        if I select the introduction and build>quickpreview>selection, I get:

        ===============================================
        [PreviewLaTeX] preview.tex => preview.dvi (latex)
        [PreviewLaTeX] finished with exit status 1
        ./kk:8:No file preview.aux.
        ./kk:20:Undefined control sequence. ...tro intro intro intro intro intro \needref
        ./kk:22:Undefined control sequence. \xvspace
        ./kk:8: Label(s) may have changed. Rerun to get cross-references right.
        [PreviewLaTeX] 2 errors, 2 warnings, 0 badboxes
        ===============================================

        and in the log:

        ===============================================


        * PreviewLaTeX output:
        cd '/tmp/kde-ikerlg9OYUa/kilerNm4Mp'
        ** latex -interaction=nonstopmode 'preview.tex'


        This is pdfTeXk, Version 3.141592-1.40.3 (Web2C 7.5.6)
        %&-line parsing enabled.
        entering extended mode
        (./preview.tex
        LaTeX2e <2005/12/01>
        Babel <v3.8h> and hyphenation patterns for english, usenglishmax, dumylang, noh
        yphenation, croatian, ukrainian, russian, bulgarian, czech, slovak, danish, dut
        ch, finnish, basque, french, german, ngerman, ibycus, greek, monogreek, ancient
        greek, hungarian, italian, latin, mongolian, norsk, icelandic, interlingua, tur
        kish, coptic, romanian, welsh, serbian, slovenian, estonian, esperanto, upperso
        rbian, indonesian, polish, portuguese, spanish, catalan, galician, swedish, loa
        ded.
        (/usr/share/texmf-texlive/tex/latex/base/article.cls
        Document Class: article 2005/09/16 v1.4f Standard LaTeX document class
        (/usr/share/texmf-texlive/tex/latex/base/size10.clo))
        (/usr/share/texmf-texlive/tex/latex/graphics/color.sty
        (/etc/texmf/tex/latex/config/color.cfg)
        (/usr/share/texmf-texlive/tex/latex/graphics/dvips.def)
        (/usr/share/texmf-texlive/tex/latex/graphics/dvipsnam.def))
        No file preview.aux.
        ! Undefined control sequence.
        l.12 ...tro intro intro intro intro intro \needref
        intro intro intro intro i...

        ! Undefined control sequence.
        l.14 \xvspace
        {7ex} More more more more more more more.
        [1] (./preview.aux)

        LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right.

        )
        (see the transcript file for additional information)
        Output written on preview.dvi (1 page, 524 bytes).
        Transcript written on preview.log.
        ==============================================

        But if I select the text starting from the command definition (command definition, title and introduction), everything goes OK.

        Maybe I'm doing sth wrong?

         
        • Thomas Braun

          Thomas Braun - 2008-11-19

          Hi,

          have you tried to set the newcommands into the preamble (above of \begin{document}) and then select some text for quickpreview?

          Thomas

           

Log in to post a comment.

MongoDB Logo MongoDB