Major clean up of the "Writing LaTeX files" section

This commit is contained in:
Gerard Vermeulen 2024-06-17 20:10:27 +02:00
parent b3de63f546
commit 6ca1bf3491

View File

@ -1940,16 +1940,11 @@ Emacs will complain that ~TeX-master~ is no safe local variable in case it reads
a LaTeX file that sets ~TeX-master~. The list below summarizes the main [[https://en.wikipedia.org/wiki/AUCTeX][AUCTeX]]
configuration objectives:
1. Listing [[lst:set-tex-options]] ensures installation of [[https://en.wikipedia.org/wiki/AUCTeX][AUCTeX]] and initializes
[[https://en.wikipedia.org/wiki/AUCTeX][AUCTeX]] properly for =LuaTeX= or =LuaLaTeX=.
2. Listing [[lst:set-tex-options]] also enables *indenting between square brackets*
which is a recent feature.
3. Listing [[lst:update-lualatex-opentype-font-name-database]] defines a function to
update the =OpenType Font= name database for =LuaLaTeX= when the output of
=LuaLaTeX= shows missing fonts.
4. Listing [[lst:set-bibtex-options]] configures the Emacs =bibtex= library to use
the LaTeX =BiBTeX= dialect for backwards compatibility.
5. Listing [[lst:set-font-latex-options]] disables font scaling of section titles.
6. Listing [[lst:set-latex-options]] configures =latex= for a full featured
[[https://en.wikipedia.org/wiki/AUCTeX][AUCTeX]] properly for =LuaTeX= or =LuaLaTeX=. Listing [[lst:set-tex-options]] also
enables *indenting between square brackets* which is a recent feature.
2. Listing [[lst:set-latex-related-options]] configures the Emacs =bibtex= library
to use the LaTeX =BiBTeX= dialect for backwards compatibility, disables font
scaling of section titles, and configures =latex= for a full featured
=LaTeX-section-command=.
#+caption[Ensure =AUCTeX= installation and set =TeX= option]:
@ -1969,43 +1964,16 @@ configuration objectives:
TeX-electric-math nil)))
#+end_src
#+caption[Update the =LuaLaTeX OpenType Font= name database]:
#+caption: Update the =LuaLaTeX= =OpenType Font= name database.
#+name: lst:update-lualatex-opentype-font-name-database
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'emacs
(defun update-lualatex-opentype-font-name-database ()
"Update the \"OpenType Font\" name database for \"LuaLaTeX\"."
(interactive)
(let* ((pair (get-program-code-output
"luaotfload-tool" "-vv" "--update" "--force"))
(return-code (car pair))
(output (cdr pair)))
(if (= 0 return-code)
(message "%s" (string-trim output))
(error "%s" (string-trim output))))))
#+end_src
#+caption[Set =bibtex= options]:
#+caption[Set =LaTeX= options]:
#+caption: Set =bibtex= options.
#+name: lst:set-bibtex-options
#+name: lst:set-latex-related-options
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'bibtex
(setopt bibtex-dialect 'BibTeX))
#+end_src
#+caption[Set =font-latex= options]:
#+caption: Set =font-latex= options.
#+name: lst:set-font-latex-options
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'font-latex
(setopt font-latex-fontify-sectioning 1.0))
#+end_src
#+caption[Set =latex= options]:
#+caption: Set =latex= options.
#+name: lst:set-latex-options
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'latex
(setopt LaTeX-electric-left-right-brace t
LaTeX-section-hook '(LaTeX-section-heading
@ -2627,30 +2595,6 @@ valid directories and files. In an [[https://orgmode.org/][Org-mode]] buffer th
1. src_emacs-lisp{(call-interactively 'citar-insert-citation)}.
2. src_emacs-lisp[:results silent]{(call-interactively 'citar-open)}.
*** TODO Compare bibtex and biblatex
1. [[https://www.economics.utoronto.ca/osborne/latex/BIBTEX.HTM][Using bibtex: a short guide]]
2. [[https://www.tug.org/texlive//devsrc/Master/texmf-dist/doc/latex/biblatex/biblatex.pdf][The biblatex package]]
3. [[https://github.com/yuchenlin/rebiber][Rebiber: A tool for normalizing bibtex with official info]]
4. [[https://github.com/josephwright/biblatex-phys][A biblatex implementation of the AIP and APS bibliography style]]
#+caption[Delete =Biber= cache when =Biber= fails to make a bibliography]:
#+caption: Delete =Biber= cache when =Biber= fails to make a bibliography.
#+name: lst:delete-biber-cache
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'emacs
;; https://tex.stackexchange.com/a/579356 answers
;; "How to solve Biber exiting with error code 2 but no error messages?"
(defun biber-delete-cache ()
"Delete the `Biber' cache to get rid of `Biber' exit code 2."
(interactive)
(let* ((pair (get-program-code-output "rm" "-rf" "$(biber --cache)"))
(return-code (car pair))
(output (cdr pair)))
(if (= 0 return-code)
(message "%s" (string-trim output))
(error "%s" (string-trim output))))))
#+end_src
*** [[https://github.com/tecosaur/engrave-faces#readme][Engrave Faces]]
:PROPERTIES:
:CUSTOM_ID: sec:engrave-faces