top | item 41828629

(no title)

vslavkin | 1 year ago

It's pretty easy, actually. First, install the plugin, I use this with elpaca: ``` (use-package latex :ensure nil :hook (LaTeX-mode . TeX-fold-mode) ;; I don't use a lot the fold, but it's useful (LaTeX-mode . turn-on-reftex) ;; For biblatex (LaTeX-mode . LaTeX-math-mode) ;; For inserting math symbols, altough I think cdlatex is better (LaTeX-mode . outline-minor-mode) ;; If you use outline to surf throughout the buffer ;; (LaTeX-mode . abbrev-mode) ;; If you use abbrevs (LaTeX-mode . visual-line-mode) ;; Either this or auto-fill-mode, which will return when you have more than the `fill-column` characters (LateX-mode . prettify-symbols-mode) ;; Will replace most latex math symbols with unicode :bind (:map LaTeX-mode-map ("s-a" . abbrev-mode) ("s-c" . preview-clearout-at-point) ("s-q" . LaTeX-fill-buffer) ) :custom (TeX-auto-save t) (TeX-parse-self t) (preview-auto-cache-preamble nil) ;; Setting this to t should be faster, but for me it wouldn't work with lualatex (TeX-command-extra-options "-shell-escape") ;; Use pdf-tools to open PDF files (TeX-view-program-selection '((output-pdf "PDF Tools"))) ;; I use pdf-tools to read the pdf in emacs (TeX-save-query nil) ;; Auto save without saving (TeX-show-compilation nil) ;; Hide the compilation (TeX-engine 'luatex) (reftex-plug-into-AUCTeX t) ;; I think this is redundant (TeX-source-correlate-mode t) ;; To enable synctex (click on the pdf to go to source) (TeX-source-correlate-start-server t) :config (add-to-list 'TeX-command-list '("Make" "make" TeX-run-command nil t)) ;; Update PDF buffers after successful LaTeX runs (add-hook 'TeX-after-compilation-finished-functions #'TeX-revert-document-buffer) )

    (use-package auctex
      :ensure  (auctex :pre-build (("./autogen.sh")
              ("./configure" "--without-texmf-dir" "--with-lispdir=.")
              ("make")))
      :demand
      :mode (("\\.tex\\'" . LaTeX-mode)
      ("\\.tex\\.erb\\'" . LaTeX-mode)
      ("\\.etx\\'" . LaTeX-mode))
      :config
      (with-eval-after-load 'preview
        (dolist (env '("tikzpicture" "circuitikz")) ;; I want to preview tikzpictures and icrcuitikz
          (add-to-list 'preview-default-preamble
         (concat "\\PreviewEnvironment{" env "}") t))
        (add-to-list 'preview-inner-environments "axis") ;; And axis (pgfplots)
        (set-face-attribute 'preview-reference-face nil
       :foreground "black"
       :background "white")))
        ;; Tikz previews look better with a white background, if you don't use it, it's way cooler to preview latex with a "trasparent" background
```

And then the usage:

Just continue using latex as you are, and then try to incorporate auctex commands. The most useful being =latex-environment= and =latex-section= + the previews. So don't write \begin{env}... nor \section{sec}, and instead use C-c C-e and C-c C-s (They seem hard, but they aren't) For the previews, use C-c C-p ... (there are a lot of options there, using which-key you can see them) And for compiling use C-c C-c. I recommend reading https://karthinks.com/software/latex-input-for-impatient-sch... and if you have the time, read bits of the manual

(Sorry, I can't get the code to display right. goto https://gitlab.com/vslavkin/emacs-config/-/blob/master/emacs... and search for the latex heading)

discuss

order

No comments yet.