I am communication with my coauthors via email. This time, I am the author, so I send them the PDF file of the document, and they send me corrections. Then I'd like to implement these corrections. They are of the form:

In Equation (3.2) blah blah
In Theorem C blah blah

So now, what I'd like to have is a list of equations in a separate window. I would click on the appropriate entry in the list, which would then take me to the equation in my document's PDF (using Okular, if that's important), and then I could make the appropriate changes in the .tex file.

Presently, when I read "In Equation (3.2) change...", I need to scroll to Equation (3.2), make a small change then see the next error. And there are about a hundred small errors like this.

To make the system perfect, it would be great if the list of equations would automatically update itself when I make a change in the .tex file and run pdflatex.

Clearly, I'd like to have something similar for theorem-like environments.

| improve this question | | | | |
  • Is it possible to add a simple minimal working example (MWE) starting with \documentclass{...} and ending with \end{document} that illustrates your problem. It will be much easier to post precise answer and reproduce your situation otherwise it would guess/conceptual work. – texenthusiast Jun 17 '13 at 4:45

First, we need to know what you are using to create your LaTeX documents. I can only give you advice which is Emacs specific but maybe I will be lucky and that is what you are using.

This will allow you to jump to the lines in the .tex document by holding shift and left clicking the equation in your pdf.

Open Okular and go to settings-Configure Okular. A new window will open, and at the bottom, you will see Editors. There will be a drop down menu of editors you can select. In my case, I would select Emacs.

Since you are using Okular, I am going to guess you are on a Linux system. You need to set up your software to open in server mode. Again, I will be using Emacs as the example. In my ~/.bashrc, I have the following:

#  Emacs-server mode and non-GUI alias
alias emacs='emacsclient -t --alternate-editor='

This starts Emacs in server mode and I run Emacs from the terminal not the GUI.

Next, you need to set up synctex. I use LaTeXMK so I will be using it for the example of what you need to do. In my ~/.emacs, I have

;; ============ Latexmk setup ==============                                        
(defun run-latexmk ()
  (let ((TeX-save-query nil)
        (TeX-process-asynchronous nil)
        (master-file (TeX-master-file)))
    (TeX-save-document "")
    (TeX-run-TeX "latexmk"
                 (TeX-command-expand "latexmk -pdflatex='pdflatex -file-line-error 
                                   -synctex=1' -pdf %O %S" 'TeX-master-file)
    (if (plist-get TeX-error-report-switches (intern master-file))
        (TeX-next-error t)
        (minibuffer-message "latexmk: done."))))

You will see that -synctex=1 is set during the compile.

Then I had to make adjustments for Okular and settings in my custom-set-variables in my ~/.emacs file.

Okular adjustments:

;; Set okular to open with C-c C-v view option                                      
(defun Okular-make-url () (concat
     (expand-file-name (funcall file (TeX-output-extension) t)
                       (file-name-directory (TeX-master-file))
                       (expand-file-name (TeX-master-directory))

(add-hook 'LaTeX-mode-hook '(lambda ()
        (add-to-list 'TeX-expand-list
                     '("%u" Okular-make-url))))
(setq TeX-view-program-list
      '(("Okular" "okular --unique %u")))
(setq TeX-view-program-selection '((output-pdf "Okular")))

custom-set-variables adjustments:

 ;; custom-set-variables was added by Custom.                                      
 ;; If you edit it by hand, you could mess it up, so be careful.                   
 ;; Your init file should contain only one such instance.                          
 ;; If there is more than one, they won't work right.                              
 '(TeX-PDF-mode t)
 '(TeX-source-correlate-method (quote synctex))
 '(TeX-source-correlate-mode t)
 '(TeX-source-correlate-start-server t)
 '(TeX-view-program-list (quote (("Okular" "okular -unique %o#src:%n%b"))))
 '(TeX-view-program-selection (quote ((output-pdf "Okular"))))

Finally, I had to set up my ~./latexmkrc file for synctex.

$pdf_mode = 1;
$pdflatex = 'pdflatex -interaction=nonstopmode %O %S -file-line-error -synctex=1';

With this set up, I can click anywhere in my pdf and jump to the line my .tex file without having to scroll.

Basically, for whatever editor you are using, you need to set up synctex and Okular to use synctex for this to work.

To address your question on a list of the equations, you could use RefTeX which is a plugin for AUCTeX that comes with Emacs. Again, I don't know what editor you are using though. If you are using Emacs, I can update my answer with how to use RefTeX to show the equations in a separate buffer. Then you can hit r to rescan as you change your equations.

This isn't exactly what you asked for but it would work in simplifying your work load.

| improve this answer | | | | |
  • Thanks guys. I do use emacs/auctex, so the above is very helpful. I didn't know how this forum works, so actually I just noticed all these comments. – Máté Wierdl Oct 20 '14 at 14:02
  • Did this post answer your question? If so, edit your question, so it can be reopened now that we know what you were looking for. – dustin Oct 21 '14 at 13:04

Not the answer you're looking for? Browse other questions tagged or ask your own question.