Skip to content

Instantly share code, notes, and snippets.

@vermiculus
Last active August 29, 2015 14:05
Show Gist options
  • Save vermiculus/fb93129b9b0994493707 to your computer and use it in GitHub Desktop.
Save vermiculus/fb93129b9b0994493707 to your computer and use it in GitHub Desktop.
\documentclass{mla}
\title{My Title}
\author{Lily Wolford}
\date{2 September 2014}
\class{Speech 103-03}
\professor{Dr. Melinda May}
% hyphenate right margin
\RaggedRight
\usepackage{mwe}
\begin{document}
\maketitle
\lipsum[1-12]
\end{document}
%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% TeX-engine: xetex
%%% TeX-PDF-mode: t
%%% End:
\NeedsTeXFormat{LaTeX2e}[1994/06/01]
\RequirePackage{xparse}
\ProvidesExplClass
{mla}
{2014/08/30}
{0}
{MLA Paper}
\PassOptionsToClass{12pt}{article}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
\ProcessOptions*
\LoadClass{article}
\RequirePackage { microtype }
\RequirePackage { geometry }
\geometry
{
letterpaper,
margin = 1in,
showframe,
}
\RequirePackage { fontspec }
\setmainfont{Times~New~Roman}
\RequirePackage { setspace }
\setstretch { 2 }
\RequirePackage { fancyhdr }
\pagestyle{fancy}
\fancyhf { }
\cs_gset:Npn \headrulewidth { 0pt }
\rhead
{
\@lastname
\c_space_tl
\thepage
}
\raggedright
\dim_gset:Nn \parindent { 2em }
\RenewDocumentCommand \author { m o } {
\cs_gset_nopar:Npn \@author {#1}
\IfValueTF {#2} {
\cs_gset_nopar:Npx \@lastname {#2}
} {
\seq_set_split:Nnn \l_tmpa_seq { ~ } {#1}
\cs_gset_nopar:Npx \@lastname {\seq_item:Nn \l_tmpa_seq { -1 }}
}
}
\cs_new:Npn \mla_hyphen_to_dash:n #1 {
\tl_set:Nn \l_tmpa_tl {#1}
\tl_replace_all:Nnn \l_tmpa_tl
{ - } { \unskip\,\textendash\,\ignorespaces }
\tl_use:N \l_tmpa_tl
}
\NewDocumentCommand \professor { m } {
\cs_gset:Npn \@professor { \mla_hyphen_to_dash:n {#1} }
}
\NewDocumentCommand \class { m } {
\cs_gset:Npn \@class { \mla_hyphen_to_dash:n {#1} }
}
\RenewDocumentCommand \maketitle { } {
\par\noindent
\group_begin:
\frenchspacing
\dim_set:Nn \parindent { 0pt }
\@author \newline
\@professor \newline
\@class \newline
\@date \newline
\group_end:
\centerline{\@title}
\par
\thispagestyle{empty}
}
\RequirePackage { ragged2e }
\dim_gset:Nn \RaggedRightParindent { 2em }
% Local Variables:
% TeX-master: "mla"
% TeX-engine: xetex
% TeX-PDF-mode: t
% End:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment