From 2f3f5d6afb44ff3f07f192dbabea5b02af3582eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?tr=C3=A9meur?= Date: Mon, 17 May 2021 18:04:08 +0100 Subject: [PATCH] =?UTF-8?q?Remove=20some=20things=20I=20don=E2=80=99t=20us?= =?UTF-8?q?e,=20stop=20latex=20snippets=20relying=20on=20external=20files?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- init.el | 21 +-------- snippets/latex-mode/hdrs | 68 ++++++++++++++++++++++++++++-- snippets/latex-mode/latexbib | 82 ++++++++++++++++++++++++++++++++++++ 3 files changed, 148 insertions(+), 23 deletions(-) create mode 100644 snippets/latex-mode/latexbib diff --git a/init.el b/init.el index a9cbaed..f4c4c77 100644 --- a/init.el +++ b/init.el @@ -14,6 +14,7 @@ (set-selection-coding-system 'utf-8) ;; sonic arts + (setq ring-bell-function 'ignore) (setq visible-bell t) @@ -161,14 +162,6 @@ (concat user-emacs-directory (convert-standard-filename "elpa/")))) -(use-package reftex - ;; easier latex references - :init - (add-hook 'LaTeX-mode-hook 'turn-on-reftex) - (setq reftex-plug-into-AUCTeX t) - :config - (setq reftex-default-bibliography '("~/Documents/drive/res/readings/fullbib.bib"))) ; won't work currently on windows, not syncing this file - (use-package typo ;; smart quotes :custom @@ -184,9 +177,6 @@ ;; Major modes -(use-package 2048-game) -;; play the top game of 2014 - (use-package interleave) ;; for annotating pdfs in an org file @@ -276,15 +266,6 @@ (org-ellipsis " ⤵") :hook (org-mode . org-bullets-mode)) -(global-set-key [f2] 'org-capture) -(load-file "~/Documents/drive/org/capture.el") ; capture templates stored here -(setq org-capture-bookmark nil) - -(use-package org-drill - :config - (setq org-id-locations-file "~/Documents/drive/org/.org-id-locations") - (setq persist--directory-location "~/Documents/drive/org/persist")) - (setq org-todo-keywords '((sequence "TODO" "|" "DONE" "CANCELLED"))) diff --git a/snippets/latex-mode/hdrs b/snippets/latex-mode/hdrs index ed192da..b50c75d 100644 --- a/snippets/latex-mode/hdrs +++ b/snippets/latex-mode/hdrs @@ -3,10 +3,72 @@ # -- \documentclass{article} -\input{$HOME/Documents/drive/res/latex-headers-templates/headers/standard} %$ -% \input{$HOME/Documents/drive/res/latex-headers-templates/headers/bibsetup} %$ +% Dimensions +\usepackage{geometry} +\geometry{a4paper} -% \bibliography{bib} % change if necessary +% 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} diff --git a/snippets/latex-mode/latexbib b/snippets/latex-mode/latexbib new file mode 100644 index 0000000..dcea1db --- /dev/null +++ b/snippets/latex-mode/latexbib @@ -0,0 +1,82 @@ +# 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{bib} % change if necessary + +$0 \ No newline at end of file