Tidy snippets, make template for work LaTeX export

This commit is contained in:
mez 2025-07-22 11:25:15 +01:00
parent 49fbc8e7dc
commit 5f3bfbef59
35 changed files with 47 additions and 330 deletions

View file

@ -477,7 +477,7 @@ Add a couple of classes for LaTeX export.
'("article-std"
"\\documentclass{article}
[NO-DEFAULT-PACKAGES]
\\input{$HOME/.emacs.d/header.tex} %$\n% latexbib"
\\input{$HOME/.emacs.d/header.tex} %$"
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")))
@ -507,11 +507,31 @@ General export settings:
(if (string-equal user-login-name "3055822")
(progn
(setq org-export-with-author nil)
(setq org-latex-default-class "article-std"))
(setq org-latex-default-class "article-std")
(defun my/org-export-add-lines (output backend info)
"Add custom lines to the exported output."
(when (org-export-derived-backend-p backend 'latex)
(concat output "\n\n"
"%%% Local Variables: \n"
"%%% mode: latex\n"
"%%% TeX-master: t\n"
"%%% End: \n")))
(add-to-list 'org-export-filter-final-output-functions
'my/org-export-add-lines))
(if workhours
(progn
(setq org-export-with-author nil)
(setq org-latex-default-class "article-std"))
(setq org-latex-default-class "article-std")
(defun my/org-export-add-lines (output backend info)
"Add custom lines to the exported output."
(when (org-export-derived-backend-p backend 'latex)
(concat output "\n\n"
"%%% Local Variables: \n"
"%%% mode: latex\n"
"%%% TeX-master: t\n"
"%%% End: \n")))
(add-to-list 'org-export-filter-final-output-functions
'my/org-export-add-lines))
(setq org-latex-default-class "memoir")))
(setq org-latex-compiler "xelatex"))
(setq org-html-validation-link nil)

View file

@ -57,6 +57,3 @@
% Other
\usepackage{paralist}
\usepackage{verbatim}
% uncomment and expand this if there's a bibliography:
% latexbib

View file

@ -1,4 +0,0 @@
# name: chose-not-to-warn
# key: ficcntw
# --
&nbsp;<span title="$1" style="background-color:#eb7d10;color:white; font-family:serif">&nbsp;!<small>?</small>&nbsp;</span>$0

View file

@ -1,4 +0,0 @@
# name: explicit
# key: fice
# --
&nbsp;<span title="$1" style="background-color:#9c0000;color:white; font-family:serif">&nbsp;X&nbsp;</span>$0

View file

@ -1,4 +0,0 @@
# name: femslash
# key: ficfemslash
# --
&nbsp;<span title="$1" style="background-color:#d50636;color:white; font-family:serif">&nbsp;♀&nbsp;</span>$0

View file

@ -1,4 +0,0 @@
# name: general
# key: ficg
# --
&nbsp;<span style="background-color:#8ab60b;color:white; font-family:serif">&nbsp;U&nbsp;</span>$0

View file

@ -1,4 +0,0 @@
# name: gen
# key: ficgen
# --
&nbsp;<span style="background-color:#8ab60b;color:white; font-family:serif">&nbsp;☉&nbsp;</span>$0

View file

@ -1,4 +0,0 @@
# name: het
# key: fichet
# --
&nbsp;<span title="$1" style="background-color:#670840;color:white; font-family:serif">&nbsp;⚤&nbsp;</span>$0

View file

@ -1,4 +0,0 @@
# name: mature
# key: ficm
# --
&nbsp;<span title="$1" style="background-color:#eb7d10;color:white; font-family:serif">&nbsp;M&nbsp;</span>$0

View file

@ -1,4 +0,0 @@
# name: multi
# key: ficmulti
# --
&nbsp;<span title="$1"><span style="background:linear-gradient(0deg, rgba(160,0,24,1) 0%, rgba(160,0,24,1) 49%, rgba(171,203,0,1) 50%, rgba(171,203,0,1) 100%);">&nbsp;&nbsp;</span><span style="background: linear-gradient(0deg, rgba(0,51,148,1) 0%, rgba(0,51,148,1) 49%, rgba(129,0,108,1) 50%, rgba(129,0,108,1) 100%);">&nbsp;&nbsp;</span></span>$0

View file

@ -1,4 +0,0 @@
# name: other
# key: ficother
# --
&nbsp;<span title="$1" style="background-color:black;color:white; font-family:serif">&nbsp;☿&nbsp;</span>$0

View file

@ -1,4 +0,0 @@
# name: fic-hosted-on-praze
# key: ficpraze
# --
https://tre.praze.net/fic/single/$0

View file

@ -1,4 +0,0 @@
# name: slash
# key: ficslash
# --
&nbsp;<span title="$1" style="background-color:#1256b6;color:white; font-family:serif">&nbsp;♂&nbsp;</span>$0

View file

@ -1,4 +0,0 @@
# name: teen
# key: fict
# --
&nbsp;<span title="$1" style="background-color:#e8d405;color:white; font-family:serif">&nbsp;G&nbsp;</span>$0

View file

@ -1,4 +0,0 @@
# name: archive-warnings
# key: ficwarnings
# --
&nbsp;<span title="$1" style="background-color:#9c0000;color:white; font-family:serif">&nbsp;!&nbsp;</span>$0

View file

@ -1,6 +0,0 @@
# name: centre
# key: cent
# --
\begin{center}
$0
\end{center}

View file

@ -1,11 +0,0 @@
# name: twocolumns
# key: col
# --
\begin{columns}
\begin{column}{0.5\textwidth}
$0
\end{column}
\begin{column}{0.5\textwidth}
\end{column}
\end{columns}

View file

@ -1,6 +0,0 @@
# name: enumerate
# key: enum
# --
\begin{enumerate}
\item $0
\end{enumerate}

View file

@ -1,7 +0,0 @@
# name: frame
# key: fr
# --
\begin{frame}
\frametitle{$1}
$0
\end{frame}

View file

@ -1,6 +0,0 @@
# name: frame-notitle
# key: frnt
# --
\begin{frame}
$0
\end{frame}

View file

@ -1,4 +0,0 @@
# name: graphics-height
# key: grh
# --
\includegraphics[height=0.9\textheight]{$0}

View file

@ -1,4 +0,0 @@
# name: graphics-width
# key: grw
# --
\includegraphics[width=\textwidth]{$0}

View file

@ -1,79 +0,0 @@
# name: latex-headers
# key: hdrs
# --
\documentclass{article}
% Dimensions
\usepackage{geometry}
\geometry{a4paper}
% Text spacing
\usepackage{microtype}
% \setlength{\parindent}{0em}
% \setlength{\parskip}{1em}
\emergencystretch 3em
\usepackage{setspace}
% \doublespacing
\usepackage[bottom]{footmisc}
% Tables
\usepackage{float}
\usepackage{tablefootnote}
\usepackage{makecell}
\renewcommand{\cellalign}{cl}
\usepackage{etoolbox}
\AtBeginEnvironment{tabular}{\doublespacing}
\usepackage{array}
\usepackage{booktabs}
% Links and URLs
\usepackage[hyphens]{url}
\usepackage[hidelinks]{hyperref}
\urlstyle{tt}
% Fonts
\usepackage{mathspec}
\setmainfont{TeX Gyre Pagella}
\setmathfont(Digits){TeX Gyre Pagella Math}
\setmathfont(Latin,Greek){TeX Gyre Pagella}
% \newfontfamily\ipatext{Doulos SIL}
% \DeclareTextFontCommand{\phontrans}{\ipatext} % wrap // and [] in \phontrans
% Typographic tweaks
\usepackage{csquotes}
\makeatletter
\DeclareMathSymbol{0}{\mathalpha}{\eu@DigitsArabic@symfont}{\`0}
\DeclareMathSymbol{1}{\mathalpha}{\eu@DigitsArabic@symfont}{\`1}
\DeclareMathSymbol{2}{\mathalpha}{\eu@DigitsArabic@symfont}{\`2}
\DeclareMathSymbol{3}{\mathalpha}{\eu@DigitsArabic@symfont}{\`3}
\DeclareMathSymbol{4}{\mathalpha}{\eu@DigitsArabic@symfont}{\`4}
\DeclareMathSymbol{5}{\mathalpha}{\eu@DigitsArabic@symfont}{\`5}
\DeclareMathSymbol{6}{\mathalpha}{\eu@DigitsArabic@symfont}{\`6}
\DeclareMathSymbol{7}{\mathalpha}{\eu@DigitsArabic@symfont}{\`7}
\DeclareMathSymbol{8}{\mathalpha}{\eu@DigitsArabic@symfont}{\`8}
\DeclareMathSymbol{9}{\mathalpha}{\eu@DigitsArabic@symfont}{\`9}
\makeatother
% Language
\usepackage{polyglossia}
\setdefaultlanguage[variant=british]{english}
\setotherlanguages{french} % for some reason this displays footnotes correctly?
% Other
\usepackage{paralist}
\usepackage{verbatim}
% uncomment and expand this if there's a bibliography:
% latexbib
\title{}
\author{}
\date{}
\begin{document}
\maketitle
$0
\end{document}

View file

@ -1,4 +0,0 @@
# name: item
# key: it
# --
\item

View file

@ -1,6 +0,0 @@
# name: itemize
# key: item
# --
\begin{itemize}
\item $0
\end{itemize}

View file

@ -1,85 +0,0 @@
# name: latex-bibsetup
# key: latexbib
# --
%
\usepackage[style=authoryear-ibid,alldates=long,giveninits=true,dashed=false,labeldate=year,mergedate=maximum,maxbibnames=10,ibidpage=true,uniquename=false]{biblatex}
\renewbibmacro*{volume+number+eid}{ % puts issue number in brackets
\printfield{volume}
\printfield{number}
\setunit{\addcomma\space}
\printfield{eid}}
\DeclareFieldFormat[article]{number}{\mkbibparens{#1}}
\renewbibmacro{in:}{ % gets rid of In for journal articles
\ifentrytype{article}
{}
{\printtext{\bibstring{in}\intitlepunct}}}
\DefineBibliographyStrings{english}{ % changes visited on to accessed
urlseen={Accessed},
}
\DeclareFieldFormat[article]{pages}{#1} % gets rid of pp. for journal articles
\DeclareNameAlias{sortname}{family-given} % stops 2nd author being listed first last
\renewcommand*{\intitlepunct}{\space} % deletes colon after In
\AtEveryBibitem{\uspunctuation} % fixes full stop placement
\renewcommand*{\postnotedelim}{\addcolon} % replaces p. in text with colons
\DeclareFieldFormat{postnote}{#1}
\DeclareFieldFormat{multipostnote}{#1}
\DeclareFieldFormat{origdate}{\mkbibbrackets{#1}} % year first published
\renewbibmacro*{cite:labeldate+extradate}{%
\iffieldundef{origyear}
{}
{\printorigdate
\setunit{\addspace}}%
\iffieldundef{labelyear}
{}
{\printtext[bibhyperref]{\printlabeldateextra}}}
\DeclareCiteCommand{\citeorigyear}
{\boolfalse{citetracker}%
\boolfalse{pagetracker}%
\usebibmacro{prenote}}
{\printfield{origyear}}
{\multicitedelim}
{\usebibmacro{postnote}}
\renewbibmacro*{date+extradate}{%
\iffieldundef{origyear}
{}
{\printorigdate
\setunit{\addspace}}%
\iffieldundef{labelyear}
{}
{\printtext[parens]{%
\iflabeldateisdate
{\printdateextra}
{\printlabeldateextra}}}}
\renewbibmacro*{begentry}{% % adds short author in square brackets where applicable
\ifnameundef{shortauthor}
{}
{\bibopenbracket\printnames{shortauthor}%
\bibclosebracket\space}}
\DefineBibliographyExtras{english}{% % D M Y format in bibliography
\protected\def\mkbibdatelong#1#2#3{%
\iffieldundef{#3}
{}
{\stripzeros{\thefield{#3}}%
\iffieldundef{#2}{}{\nobreakspace}}%
\iffieldundef{#2}
{}
{\mkbibmonth{\thefield{#2}}%
\iffieldundef{#1}{}{\space}}%
\stripzeros{\thefield{#1}}}%
}
\bibliography{`(with-temp-buffer
(insert-file-contents "~/Documents/drive/admin/emacs/bibpath")
(buffer-string))`}
$0

View file

@ -1,31 +0,0 @@
# name: latex-metropolis
# key: metro
# --
\documentclass{beamer}
\usetheme[numbering=fraction,progressbar=foot]{metropolis}
\usefonttheme{professionalfonts}
\usepackage{mathspec}
\setsansfont[BoldFont={Fira Sans},
Numbers={OldStyle}]{Fira Sans Light}
\setmathsfont(Digits)[Numbers={Lining, Proportional}]{Fira Sans Light}
\metroset{block=fill}
% uncomment and expand this if there's a bibliography:
% latexbib
\title{$1}
\author{$2}
\date{$3}
\begin{document}
\frame{\titlepage}
$0
% \begin{frame}[allowframebreaks]
% \printbibliography
% \end{frame}
\end{document}

View file

@ -1,6 +0,0 @@
# name: source
# key: source
# --
\begin{flushright}
\scriptsize\cite[$2]{$1}
\end{flushright}$0

10
snippets/org-mode/article Normal file
View file

@ -0,0 +1,10 @@
# name: article
# key: article
# --
#+TITLE: ${1}
#+LATEX_HEADER: \input{\$HOME/Documents/drive/admin/emacs/latexbib.tex} %\$
$0
@@latex:\printbibliography[title=References]@@

8
snippets/org-mode/artsec Normal file
View file

@ -0,0 +1,8 @@
# name: artsec
# key: artsec
# --
* ${1:Section title}
** plan :noexport:
$0
** text :ignore:

View file

@ -1,4 +0,0 @@
# name: fanfiction-link
# key: ficlink
# --
@@html:<a href="$1">$2</a>$3&nbsp;<code>$4</code>@@$0

5
snippets/text-mode/oe Normal file
View file

@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: oe
# key: oe
# --
œ

View file

@ -1,8 +0,0 @@
# name: border-box
# key: bbox
# --
*, *::before, *::after {
box-sizing: border-box;
}
$0

View file

@ -1,4 +0,0 @@
# name: fanfiction-link
# key: ficlink
# --
<a href="$1">$2</a>$3&nbsp;<code>$4</code>$0