This repo contains an emacs configuration that can be used for editing Galacticus source code in emacs.
Galacticus source files are modern Fortran, but with embedded sections of XML and LaTeX. It is recommended to use polymode to handle these three separate languages in a single emacs buffer.
Also provided is a a custom f90-mode which has been modified to support these source files, along with a modified outline-mode to allow collapsing/expanding sections of the code.
Finally, texfrag-mode is used to render LaTeX math in the emacs window.
C-c C-p C-d
render all LaTeX math in the buffer.
A screenshot showing an example of LaTeX math rendered in the buffer:
A screenshow showing mixed Fortran and XML in a single buffer with appropriate syntax highlighting and indentation for each:
If you use a dark theme in emacs. preview-latex should automatically detect the color theme and render the LaTeX equations with the same background and forground colors. This does not work in some versions of GhostScript, according to this answer. It is recommended to use GhostScript 9.54.0 which renders the colors correctly.