Skip to content

Instantly share code, notes, and snippets.

@sixtyfive
Last active August 29, 2015 14:23
Show Gist options
  • Save sixtyfive/a8a0aa886b14ec8398fb to your computer and use it in GitHub Desktop.
Save sixtyfive/a8a0aa886b14ec8398fb to your computer and use it in GitHub Desktop.
Changed version of the mla13 LaTeX style for my needs
\ProvidesPackage{mla13}
\usepackage[a4paper]{geometry} % jrs: changed from letterpaper.
\usepackage[english,german]{babel} % jrs: changed from american.
\usepackage{csquotes}
\setlength{\parindent}{0.75cm} % jrs: changed from 0.5em
\usepackage[style=mla,mladraft=true,annotation=true,backend=biber]{biblatex}
\usepackage{color}
\newcommand{\sources}[1]{
\def\@sources{#1}
\bibliography{#1}
}
%removes the space added to the center enviornment
\newenvironment{nospacecenter}{\parskip=0pt\par\nopagebreak\centering}{\par\noindent\ignorespacesafterend}
%Formatting Commands
\renewcommand \thesection {\@arabic\c@section.}
\renewcommand\thesubsection {\thesection\@arabic\c@subsection}
% jrs: this changes section headings
%\renewcommand\section{\@startsection{section}{1}{\z@}%
%{\z@}%
%{\lineskip}%
%{\normalfont}}
%\renewcommand\subsection{\@startsection{subsection}{2}{\z@}%
%{\z@}%
%{\lineskip}%
%{\normalfont}}
%\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
%{\z@}%
%{\lineskip}%
%{\normalfont}}
\renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}%
{\z@}%
{\lineskip}%
{\normalfont}}
\renewcommand\subparagraph{\@startsection{subparagraph}{5}{\parindent}%
{\z@}%
{\lineskip}%
{\normalfont}}
%Bibliography Commands
\DeclareFieldFormat{ibidpostnote}{#1}%
\newbibmacro*{cite:idem}{%
\ifsingletitle%
{\iffieldundef{postnote}%
{\usebibmacro{cite:name}}%
{\unspace\global\boolfalse{cbx@named}}}%
{\addspace\global\boolfalse{cbx@named}}}
\newbibmacro*{cite:mla:title:internal}{% 0.7.1 new internal macro
\ifbool{cbx@named}%
{\unspace\addcomma\addspace}%
{}%
\iffieldundef{title}%
{\iffieldequalstr{entrytype}{review}%
{\printtext[bibhyperref]{\printtext{\bibstring{reviewof}%
\addspace\printfield{booktitle}}}}%
{\ifthenelse{\iffieldequalstr{entrytype}{suppbook}% 0.7.1
\OR\iffieldequalstr{entrytype}{suppcollection}}%
{\printtext[bibhyperref]{%
\printfield[mla:capital]{entrysubtype}}}%
{}}}%
{\printtext[bibhyperref]{%
\printfield[citetitle:\strfield{entrytype}]{labeltitle}}}}%
\newbibmacro*{cite:mla:title}{% 0.7.1 tidied up
\unspace%
\ifnameundef{labelname}%
{\unspace%
\printtext[bibhyperref]{%
\printfield[citetitle:\strfield{entrytype}]{labeltitle}}%
\iffieldundef{postnote}%
{}%
{\addspace}}%
{\ifsingletitle%
{}%
{\usebibmacro{cite:mla:title:internal}\addspace}}%
\ifthenelse{\iffieldequalstr{entrytype}{review}%
\and\ifnameundef{author}%
\and\iffieldundef{title}}%
{\printtext[bibhyperref]%
{\unspace\printtext{\bibcpstring{reviewof}%
\addspace\printfield{booktitle}}}}%
{}}%
\DeclareCiteCommand{\cite}[\mkbibparens]
{\usebibmacro{prenote}}%
{\usebibmacro{citeindex}%
\usebibmacro{cite:mla}}{}
{\usebibmacro{postnote}}
\defbibheading{apa}[\refname]{}
%Annotations for the Bibliography
\renewbibmacro{finentry}{%Renew the annotation macro
\finentry
\iffieldundef{annotation}%
{}%
{\ifbool{bbx@annotation}%
{\begin{quotation}\noindent%Make the annotation look like a quotation and remove the indent
\printfield{annotation}%
\end{quotation}}%
{}}%
}
%End Annotation Section
% Formatting Section Headings
%\def\section{\@startsection{section}{1}{\z@}{-5.25ex plus -1ex minus
%-.2ex}{3.5ex plus .2ex}{\center}} % jrs changed 1.5ex to 3.5ex
\def\thesection{\arabic{section}}
% End Formatting Section Headings
%End Bibliography Commands
%remove parenthesis from bibliography
%\renewbibmacro*{issue+date}{%
% \setunit{\addcomma\space}% NEW
% \printtext[parens]{% DELETED
% \iffieldundef{issue}
% {\usebibmacro{date}}
% {\printfield{issue}%
% \setunit*{\addspace}%
% \usebibmacro{date}}}% DELETED
% \usebibmacro{date}}% NEW
% \newunit}
%end section
\geometry{top=3cm,bottom=3cm,left=2.5cm,right=2.5cm} % jrs: changed from 1in for all four sides.
\usepackage{datetime}
\usepackage{fancyhdr}
\newcommand{\university}[1]{
\def\@university{#1}
}
\newcommand{\faculty}[1]{
\def\@faculty{#1}
}
\newcommand{\institute}[1]{
\def\@institute{#1}
}
\newcommand{\typeofwork}[1]{
\def\@typeofwork{#1}
}
\newcommand{\firstassessor}[1]{
\def\@firstassessor{#1}
}
\newcommand{\secondassessor}[1]{
\def\@secondassessor{#1}
}
\newcommand{\matriculationnumber}[1]{
\def\@matriculationnumber{#1}
}
\newcommand{\emailaddress}[1]{
\def\@emailaddress{#1}
}
\newcommand{\streetandhousenumber}[1]{
\def\@streetandhousenumber{#1}
}
\newcommand{\postcodeandcity}[1]{
\def\@postcodeandcity{#1}
}
\newcommand{\workperiodstart}[1]{
\def\@workperiodstart{#1}
}
\newcommand{\workperiodend}[1]{
\def\@workperiodend{#1}
}
% \pagestyle{empty}
% \pagestyle{fancy}
\fancyhf{}
\fancyhead{}
\renewcommand{\headrulewidth}{0pt}
% \rhead{\@lastname\ \thepage} % jrs: this was name and page number at upper right corner.
% \newdateformat{datef}{\THEDAY. \monthname[\THEMONTH] \THEYEAR}
\newcommand*{\makeheader}{
\selectlanguage{german}
\rmfamily
\fontsize{12}{2}
\begin{center}
\begingroup
\@university\\
\@faculty\\
\@institute\\
\endgroup
\vspace*{1cm}
\begingroup
\@title \\
\@subtitle\\
\endgroup
\vspace*{1cm}
\begingroup
\@typeofwork \\
\endgroup
\vspace*{1cm}
\begingroup
1. Gutachter: \@firstassessor, \\
2. Gutachter: \@secondassessor \\
\endgroup
\vspace*{1cm}
\begingroup
Vorgelegt von \\
\@author, \\
Matrikel-Nr.: \@matriculationnumber, \\
\@emailaddress, \\
\@streetandhousenumber \\
\@postcodeandcity, \\
am \today \\
\endgroup
\vspace*{1cm}
\begingroup
Bearbeitungszeitraum: \@workperiodstart--\@workperiodend
\endgroup
\selectlanguage{english}
\end{center}
}
\newcommand*{\makeworkscited}{\begingroup
\pagebreak
\section{Works Cited}
\printbibliography[heading=apa]
\endgroup}
% jrs: Things needed beyond what mla13 provided.
\usepackage{url}
\usepackage[hidelinks]{hyperref}
\usepackage{import}
\usepackage{tocstyle}
\usepackage[nottoc,numbib]{tocbibind}
\usepackage{booktabs}
\usepackage{graphicx}
\usepackage{blindtext}
\usepackage{pdfpages}
\usepackage{array}
\usepackage{longtable}
\usepackage{geometry}
\usepackage{fontspec}
\usepackage{polyglossia}
\setmainlanguage{english}
\setotherlanguage{arabic}
\newfontfamily\arabicfont[Script=Arabic,Scale=1.5]{Scheherazade}
\usepackage{setspace}
\onehalfspacing
\sources{references.bib}
\setmainfont[Ligatures=TeX]{Charis SIL}
\setmonofont{Charis SIL}
\setsansfont{DejaVu Sans}
\newcommand{\latin}[1]{{\emph{#1}}} % For easier handling of how latin phrases are formatted.
\newcommand{\dmg}[1]{{\emph{#1}}} % The same for DMG transliteration.
\newcommand{\textar}[1]{\fontspec{Arabic Typesetting}\beginR{#1}\endR\rmfamily}
\newcolumntype{L}[1]{>{\raggedright\arraybackslash}p{#1}}
\newcolumntype{R}[1]{>{\raggedleft\arraybackslash}p{#1}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment