jueves, 18 de enero de 2018

Emacs: backward/inverse search

After install AucTex, turn on the following two modes:

1.- to work with pdf reader (evince for me) instead of dvi:
      M-x TeX-PDF-mode

2.- and activate the backward search:
      M-x TeX-source-correlate-mode

You may load this modes automatically editing the .emacs file (see (*) at the bottom of this message).


Next, you must to compile the tex file with the option \synctex=1. There are two ways to do this:

1.- running the command
      pdflatex -synctex=1  your-tex-file.tex

(see (**));

2. or touch the preamble of the tex file:
       \documentclass{article}
       \synctex=1
       \begin{document}
       ...
       \end{document}
       \documentclass{article}

I think the best option is to always use a Makefile with the first option inside.


After compiling, will be generated a file *.synctex.gz


And...  Ready!


- In the tex file, to go to the pdf:

      C-c C-v    ( or  M-x TeX-View )

- In the pdf file, to go to the corresponding place in the tex file:

      Control + right click mouse

-------------------------------------------------------------------------------------

(*)  To choise this option all times you open emacs, add to the ~/.emacs file the following two lines:

            (setq TeX-PDF-mode t)
            (setq TeX-source-correlate-mode t)

(**) You could automatize this creating an alias, for example adding to your .bash_profile the line:
 alias pdflatex='pdflatex -synctex=1'
But I think that the best option is to choise this in a Makefile file.

No hay comentarios.: