Skip to content

hegde-atri/org-mode-latex-templates

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

org-mode-latex-templates

Preface

Here are some the SETUPFILEs I use when I am writing documents that I will import into a $\LaTeX$.

If you are using these templates for real work, check out the sections under Report.org for more detail on writing in org-mode and exporting to latex.

Auto updating $\LaTeX$ pdf preview

In the example-report folder, check the bottom commented header in the org file (at the very bottom), and the .latexmkrc.

You will need these to setup auto compiling of the org → tex → pdf.

Table of Contents

simple.org

Example

#+title: Big title
#+subtitle: Subtitle
#+AUTHOR: Your name
#+SETUPFILE: ~/.config/doom/latex-templates/report.org

#+LATEX_HEADER: \fancyhead[C]{Title here}
#+LATEX_HEADER: \fancyfoot[C]{\thepage}

#+LATEX: \newpage

Start here...

report.org

To use it just add the setupfile line. Setupfile should point to wherever you’re report.org is on your disk.

Example file

A real example file is in the works and coming soon…

#+title: Big title
#+subtitle: Subtitle
#+AUTHOR: Your name
#+SETUPFILE: ~/.config/doom/latex-templates/report.org

#+LATEX_HEADER: \fancyhead[C]{Title here}
#+LATEX_HEADER: \fancyfoot[C]{\thepage}

#+LATEX: \newpage

Start here...

Header and Footer

We are using fancyhdr package to achieve this.

Tables

To get column lines add this to the line above your table.

c|c|c|c is for a table with four columns, and each aligned to the center. You can change c to l or r to change this. Adjust accordingly depending on how many columns you have.

#+ATTR_LATEX: :align c|c|c|c

Figures

When displaying figures you have control or its placement, size and orientation.

#+ATTR_LATEX: :width 60px :placement [H] :options angle=90

Have a look at the different placement options below.

Placement options

Specifier Placement
h Place float here. (approximately at the same point it occurs in source text.)
t Top of the page.
b Bottom of the page.
p Special page for figures only
! Override internal parameters $\LaTeX$ uses for determining “good positions”
H Places precisely at the lcataion in the $\LaTeX$ code. Requires the float package.

Syntax highlighting

If you are including code blocks in your document and you want it to be pretty than add this to your emacs config.

If you are using Doom Emacs it will be in your config.el

(setq org-latex-listings 'minted
      org-latex-packages-alist '(("" "minted"))
      org-latex-pdf-process
      '("pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
        "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"))

Bibliography

To add bibliography to your org file, create a .bib file. Let’s name ours bibliography.bib.

We’ll now need to tell our org file about it.

To the top of the file let’s add a new property - #+BIBLIOGRAPHY: bibliography.bib.

Imagine we had this entry in our bib file.

@article{example_citation,
  title={Literate Programming},
  author={Donald E. Knuth},
  journal={The Computer Journal},
  volume={27},
  number={2},
  pages={97--111},
  year={1984},
  publisher={Oxford University Press}
}

We can reference this either through this notation [cite:@example_citation].

Or an easier way to do it is through org-cite-insert or SPC m @.

A really use full resource for org citations - https://blog.tecosaur.com/tmio/2021-07-31-citations.html#cite-syntax

Citation Format

You can mention page or page range by [cite:@example_citation p. 5] [cite:@example_citation pp. 5-10]

There are a LOT of options like chap., para., pp., v., … etc

A good style and variant option is [cite/t/cf:@example_citation] in the format of [cite/style/variant:@thing].

Footnotes

You can create footnotes with SPC m f. Create footnotes with citation for a clean look.

Other resources

TODOLIST

About

Org-mode templates that I use to export to LaTeX/PDF

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published