You are not logged in.

#1 2009-10-03 09:19:03

Lich
Member
Registered: 2009-09-13
Posts: 437

Make emacs+LaTeX/Auctex more WYSIWYG

Ok so I thought I make a new thread on this issue, since I didn't want to hijack the screenshots thread.
Pank posted this: http://omploader.org/vMmdrZQ
I see his formulae are right there, visible, kinda like WYSIWYG. So is a chapter name, you can see it in bold.
How could I set that thing up?
For example I write a lot of reports using LaTeX, but no fancy stuff, only page headers, titles etc. I often have bold text inside normal text, bigger text for titles etc. How could I set emacs up to see all this while I'm editing? Right now I have to compile my .tex to see the result. It would be nice to see my stuff while editing
Any ideas and advice welcomed


Archlinux | ratpoison + evilwm | urxvtc | tmux

Offline

#2 2009-10-03 09:45:54

Lich
Member
Registered: 2009-09-13
Posts: 437

Re: Make emacs+LaTeX/Auctex more WYSIWYG

Ok, apparently I needed preview-latex wich works great with C-c, C-p C-p smile
I would really appreciate a dotemacs set for Auctex though. Pank, if you're reading this...


Archlinux | ratpoison + evilwm | urxvtc | tmux

Offline

#3 2009-10-03 10:47:52

Barrucadu
Member
From: York, England
Registered: 2008-03-30
Posts: 1,158
Website

Re: Make emacs+LaTeX/Auctex more WYSIWYG

Here's the Auctex-relevant bits from my .emacs:

(load "auctex.el"        nil t t)
(load "preview-latex.el" nil t t)

(require 'tex-site)

(setq TeX-auto-save          t
      TeX-parse-self         t
      TeX-electric-sub-and-superscript 1
      preview-scale-function 1.33)

(add-hook 'LaTeX-mode-hook 'flyspell-mode)
(add-hook 'LaTeX-mode-hook 'LaTeX-math-mode)
(add-hook 'LaTeX-mode-hook 'TeX-fold-mode)

Last edited by Barrucadu (2009-10-03 10:48:16)

Offline

#4 2009-10-03 10:49:30

Lich
Member
Registered: 2009-09-13
Posts: 437

Re: Make emacs+LaTeX/Auctex more WYSIWYG

Thanks for that Barrucadu.
I seem to have mispoken with preview-latex. It only works with maths in my test file. No bolding etc.
I need stuff like \textbf{BLABLA} to be bolded etc


Archlinux | ratpoison + evilwm | urxvtc | tmux

Offline

#5 2009-10-03 11:22:34

Barrucadu
Member
From: York, England
Registered: 2008-03-30
Posts: 1,158
Website

Re: Make emacs+LaTeX/Auctex more WYSIWYG

TeX-fold-mode does that—sort of. It does bold text in one colour, italic text in another. It also does headings, some mathematical symbols, etc.

Last edited by Barrucadu (2009-10-03 11:23:07)

Offline

#6 2009-10-03 11:59:24

arkham
Member
From: Stockholm
Registered: 2008-10-26
Posts: 516
Website

Re: Make emacs+LaTeX/Auctex more WYSIWYG

From my .emacs:

;; AUCTeX configuration
(load "auctex.el" nil t t)
(load "preview-latex.el" nil t t)
(setq TeX-auto-save t)
(setq TeX-parse-self t)
(setq-default TeX-master nil)
(setq-default ispell-dictionary "english")
(setq-default auto-fill-function 'do-auto-fill)

Edit: remember to set syntax highlighting:

;; Global syntax highlighting
(global-font-lock-mode 1)

Last edited by arkham (2009-10-03 12:01:12)


"I'm Winston Wolfe. I solve problems."

~ Need moar games? [arch-games] ~ [aurcheck] AUR haz updates? ~

Offline

#7 2009-10-03 12:53:31

Pank
Member
From: IT
Registered: 2009-06-13
Posts: 371

Re: Make emacs+LaTeX/Auctex more WYSIWYG

Fold-mode
Keys: C-c C-o C-b or look under LaTeX-->Show/Hide
This will make the buffer more readable by hiding markup commands, some environments, \item etc.
Screenshot. Notice the [f] and lack of \section{...}.
Also, see/customize the variables:

TeX-fold-env-spec-list
TeX-fold-macro-spec-list
TeX-fold-math-spec-list

Preview
Keys: C-c C-p C-d or the Preview menu.
This will generate pictures of given environments and display them in the buffer.
Screenshot. Also fold and preview.
Check the variables

preview-default-option-list

If you want to preview something other please refer to this page from the manual, notably the section `Preview your favourite LaTeX constructs'

I don't customize AUCTeX all that much. My setup is similar to arkham's setup. The following differ though:

; toggel shell escape using C-c C-t C-x
(defun TeX-toggle-escape nil (interactive)
  (setq LaTeX-command
        (if (string= LaTeX-command "latex") "latex -shell-escape" "latex")))
(add-hook 'LaTeX-mode-hook
          (lambda nil
             (define-key LaTeX-mode-map "\C-c\C-t\C-x" 'TeX-toggle-escape))) 

(eval-after-load "tex"
  '(progn 
     (add-to-list 'TeX-command-list
          (list "View in Acrobat Reader" "acroread %o"
            'TeX-run-command nil t))          
     (add-to-list 'TeX-command-list
          (list "Count Words" "texcount -inc %s.tex"
            'TeX-run-command nil t))
     (add-to-list 'TeX-command-list 
          '("Synctex" "/home/rasmus/.scripts/synctex-emacs %t %b %n" TeX-run-TeX nil t) t)
     ))

;; Maybe this needs extra fine tuning.
(eval-after-load "Rnw-mode" 
  '(progn
     (add-to-list 'TeX-command-list 
          '("pgfSweave" "ess-swv-pgfsweae ()" TeX-run-function nil t) t)
  (add-to-list 'TeX-command-list 
           '("R-Synctex" "/home/rasmus/.scripts/synctex-emacs-R %t %b %n" TeX-run-TeX nil t) t)
  ))

;;Reftex
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(add-hook 'LaTeX-mode-hook 'turn-on-reftex)   ; AUCTeX LaTeX mode
(add-hook 'latex-mode-hook 'turn-on-reftex)   ; Emacs latex mode
(setq reftex-enable-partial-scans t)
(setq reftex-save-parse-info t)
(setq reftex-use-multiple-selection-buffers t)
(setq reftex-plug-into-AUCTeX t)
(setq reftex-isearch-document t)

Arch x64 on Thinkpad X200s/W530

Offline

#8 2009-10-03 13:01:30

Lich
Member
Registered: 2009-09-13
Posts: 437

Re: Make emacs+LaTeX/Auctex more WYSIWYG

Thanks to both of you this is what I wanted. In the meantime I found a "faster" and easier way to get this: I just keep my .dvi open in xdvi, and since I use a tiling manager I have my screen split in 2: emacs and sdvi. I can see it update realtime (when I compile the dvi that is). So now after I add stuff to my .tex, I just compile and see the finished product smile
Thanks again

@Pank: what gtk theme is that btw?

Last edited by Lich (2009-10-03 13:02:08)


Archlinux | ratpoison + evilwm | urxvtc | tmux

Offline

#9 2009-10-03 13:17:59

bernarcher
Forum Fellow
From: Germany
Registered: 2009-02-17
Posts: 2,281

Re: Make emacs+LaTeX/Auctex more WYSIWYG

Lich wrote:

In the meantime I found a "faster" and easier way to get this: I just keep my .dvi open in xdvi, and since I use a tiling manager I have my screen split in 2: emacs and sdvi. I can see it update realtime (when I compile the dvi that is). So now after I add stuff to my .tex, I just compile and see the finished product smile

This is universal.
I do exactly the same with vim + vim-latex + xdvi. (Although I love auctex. But I am more proficient with vim. tongue )

Last edited by bernarcher (2009-10-03 13:19:28)


To know or not to know ...
... the questions remain forever.

Offline

#10 2009-10-03 13:21:27

Pank
Member
From: IT
Registered: 2009-06-13
Posts: 371

Re: Make emacs+LaTeX/Auctex more WYSIWYG

Another way to get near-WYSIWYG is using evince-gtk-synctex. Make sure to edit the PKGBUILD and check the actual AUR-folder for the relevant scripts. This will make AUCTeX behaver more like Texworks.

Also, customize the variable TeX-output-view-style of ^pdf to

evince %o -p %(outpage) -a

or use the emacs-script from the AUR-package.

--Rasmus


Arch x64 on Thinkpad X200s/W530

Offline

#11 2009-10-03 13:58:02

Lich
Member
Registered: 2009-09-13
Posts: 437

Re: Make emacs+LaTeX/Auctex more WYSIWYG

@bernarcher Yeh I'd use vim too if I could set a propper keyboard layout for my language tbh. I got emacs all setup for romanian and japanese (I need both), that's kind of teh only reason to use it right now
@Pank: cheers for the advice


Archlinux | ratpoison + evilwm | urxvtc | tmux

Offline

#12 2009-10-03 14:06:56

Pank
Member
From: IT
Registered: 2009-06-13
Posts: 371

Re: Make emacs+LaTeX/Auctex more WYSIWYG

Lich wrote:

Thanks to both of you this is what I wanted. In the meantime I found a "faster" and easier way to get this: I just keep my .dvi open in xdvi, and since I use a tiling manager I have my screen split in 2: emacs and sdvi. I can see it update realtime (when I compile the dvi that is).

Yeah that is pretty much what I do as well. At least with larger documents. For smaller documents I hardly bother to leave the editor. However, I cannot stand dvi-files. I always use pdf-files. Thus, evince-gtk-synctex is really quite useful since it gives me all the features of dvi's with pdfs.

Also, check latexmk. It can compile the document every time it detects changes in source-files.

@Pank: what gtk theme is that btw?

I use Elegant Brit for Pekwm and also the gtk-theme. I modified it a bit though. Actually the borders and the title line is drawn by the Pekwm skin while the menu line is drawn by the gtk theme (I hope these formulations make sense.

--Rasmus


Arch x64 on Thinkpad X200s/W530

Offline

#13 2009-10-03 14:32:47

Lich
Member
Registered: 2009-09-13
Posts: 437

Re: Make emacs+LaTeX/Auctex more WYSIWYG

Pank wrote:
Lich wrote:

Thanks to both of you this is what I wanted. In the meantime I found a "faster" and easier way to get this: I just keep my .dvi open in xdvi, and since I use a tiling manager I have my screen split in 2: emacs and sdvi. I can see it update realtime (when I compile the dvi that is).

Yeah that is pretty much what I do as well. At least with larger documents. For smaller documents I hardly bother to leave the editor. However, I cannot stand dvi-files. I always use pdf-files. Thus, evince-gtk-synctex is really quite useful since it gives me all the features of dvi's with pdfs.

Also, check latexmk. It can compile the document every time it detects changes in source-files.

@Pank: what gtk theme is that btw?

I use Elegant Brit for Pekwm and also the gtk-theme. I modified it a bit though. Actually the borders and the title line is drawn by the Pekwm skin while the menu line is drawn by the gtk theme (I hope these formulations make sense.

--Rasmus

It's the menu part that I wanted anyway so thanks smile


Archlinux | ratpoison + evilwm | urxvtc | tmux

Offline

Board footer

Powered by FluxBB