% mla.cbx, v2.0 2021/06/07 * compatible with biblatex 3.16 % Maintained at . % % Feel free to improve, redistribute, and adapt to your own ends. Please share improvements back to the project on GitHub or to James Clawson: . % % This material is subject to the LaTeX Project Public License. See http://www.ctan.org/tex-archive/help/Catalogue/licenses.lppl.html for the details of that license. \ProvidesFile{mla.cbx}[2021/06/07 v2.0 biblatex citation style] \RequireCitationStyle{mla-footnotes} \newboolean{cbx@firstlonghand}% \DeclareBibliographyOption{firstlonghand}[true]{\setboolean{cbx@firstlonghand}{#1}} \newboolean{cbx@nofullfootnote}% \DeclareBibliographyOption{nofullfootnote}[true]{\setboolean{cbx@nofullfootnote}{#1}} \DeclareBibliographyOption{mancitepar}[true]{% \ifstrequal{#1}{true}{% \let\mypkg@@everypar\everypar \newtoks\mypkg@everypar \mypkg@everypar\expandafter{\the\everypar} \mypkg@@everypar{\mypkgs@ownstuff\the\mypkg@everypar} \def\mypkgs@ownstuff{% \mancite}% \let\everypar\mypkg@everypar }{}} \DeclareBibliographyOption{footnoterulestrict}[true]{% \let\splitfootnoterule\footnoterule \renewcommand\footnoterule{}% \advance\skip\footins 4\p@\@plus2\p@\relax \gdef\split@prev{0} \let\pagefootnoterule\footnoterule \def\footnoterule{\relax \ifnum\split@prev=\z@ \pagefootnoterule \else \splitfootnoterule \fi \xdef\split@prev{\the\insertpenalties}% }} \ExecuteBibliographyOptions{citetracker=true,ibidtracker=constrict,opcittracker=constrict,singletitle,autocite=inline,uniquename=init,hyperref=true,useprefix=true,firstlonghand,annotation=false,loccittracker=strict,noremoteinfo=true,date=comp,urldate=long,mancitepar=false,datezeros=false,datecirca=true,eprint=true}% \newbool{cbx@named}% \newbool{cbx@mlafootnotes}% \newbool{cbx@hyperpages}% \newbool{cbx@mladraft}% \DeclareBibliographyOption{mladraft}[true]{% \setboolean{cbx@mladraft}{#1}} \urlstyle{same} \newbibmacro*{cite:init}{% \global\let\cbx@tempa=\empty \global\undef\cbx@lasthash} \renewcommand*{\citereset}{% \usebibmacro{cite:reset} \@ifstar {} {\global\cslet{blx@bsee@\the\c@refsection}\@empty \global\cslet{blx@fsee@\the\c@refsection}\@empty \blx@ibidreset@force \blx@idemreset@force \blx@opcitreset@force \blx@loccitreset@force}} \InitializeCitationStyle{% \usebibmacro{cite:reset}% \@expandtwoargs\in@{,draft,}{,\@classoptionslist,}% \ifin@% \ExecuteBibliographyOptions{mladraft}% draft option present \fi \long\def\mlasymbolfootnote#1{\begingroup\def% \thefootnote{\fnsymbol{footnote}}\footnote[0]{#1}\endgroup}% \newcounter{mladraftnote}} \OnManualCitation{% \usebibmacro{cite:reset}% \global\let\cbx@lastpostnote=\empty} \newbibmacro*{cite:reset}{% \global\undef\cbx@lasthash}% \newbibmacro*{cite:save}{% \savefield{entrykey}{\cbx@lastkey}% \savefield{namehash}{\cbx@lasthash}% \savefieldcs{entrykey}{cbx@lastkey@\thefield{namehash}}% \csxdef{cbx@lastcite@\thefield{entrykey}}{\the\value{instcount}}} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%% In-Line Citations %%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \newbibmacro*{cite:mla}{% \bibhypertarget{cite\the\value{instcount}}{% \ifciteseen% {\usebibmacro{cite:mla:seen}} {\usebibmacro{cite:mla:unseen}\usebibmacro{cite:save}}% \global\boolfalse{cbx@mlafootnotes}}} \newbibmacro*{cite:mla:unseen}{% \ifbool{cbx@firstlonghand} {\usebibmacro{cite:mla:noshorthand}}% {\usebibmacro{cite:mla:seen}}} \newbibmacro*{cite:mla:seen}{% \iffieldundef{shorthand}% {\usebibmacro{cite:mla:noshorthand}}% {\usebibmacro{cite:mla:shorthand}% \savefield{namehash}{\cbx@lasthash}}} \newbibmacro*{cite:mla:noshorthand}{% \ifciteibid% {\ifbool{cbx@mlafootnotes}% {\usebibmacro{cite:mla:noibid}\usebibmacro{cite:save}}% {\usebibmacro{cite:ibid}}}% {\usebibmacro{cite:mla:noibid}\usebibmacro{cite:save}}}% \newbibmacro*{cite:mla:noibid}% {\global\boolfalse{cbx@hyperpages}% \ifthenelse{\iffieldequals{namehash}{\cbx@lasthash}}% {\usebibmacro{cite:idem}% \usebibmacro{cite:mla:title}}% {\ifnameundef{labelname}% {\global\boolfalse{cbx@named}\usebibmacro{cite:mla:title}}% {\ifthenelse{\iffieldequalstr{entrytype}{incollection} \or \iffieldequalstr{entrytype}{inreference} \or \iffieldequalstr{entrytype}{review}}% {\ifnameundef{author}% {\global\boolfalse{cbx@named}% \usebibmacro{cite:mla:title}}% {\usebibmacro{cite:name}% \usebibmacro{cite:mla:title}\setunit{\addspace}}}% {\usebibmacro{cite:name}% \usebibmacro{cite:mla:title}}}}}% \newbibmacro*{cite:mla:shorthand}{% \ifciteibid% {\ifbool{cbx@mlafootnotes}% {\printtext[bibhyperref]{% \printfield[citetitle:\strfield{entrytype}]{shorthand}}\setunit{\addspace}}% {\usebibmacro{cite:ibid}}}% {\global\boolfalse{cbx@hyperpages}\printtext[bibhyperref]{% \printfield[citetitle:\strfield{entrytype}]{shorthand}}\setunit{\addspace}}} \newbibmacro*{cite:name}{% \ifsingletitle% {\printtext[bibhyperref]{% \printnames{labelname}}% \savefield{namehash}{\cbx@lasthash}% \global\booltrue{cbx@named}}% {\printnames{labelname}% \savefield{namehash}{\cbx@lasthash}% \global\booltrue{cbx@named}}}% \newbibmacro*{just:title:it}{% \iffieldequalstr{entrytype}{mlasource}% {\iffieldundef{titletype}% {\iffieldundef{titlea}% {\printtext[bibhyperref]{\printfield[mla:complete]{labeltitle}}}% {\printtext[bibhyperref]{\printfield[mla:part]{labeltitle}}}}% {\printtext[bibhyperref]{\printfield[mla:\thefield{titletype}]{labeltitle}}}}% {\ifthenelse{\(\iffieldequalstr{entrytype}{unpublished}\OR\iffieldequalstr{entrytype}{misc}\)% \AND\NOT\iffieldundef{entrysubtype}}% 2.0 added clear (next line) {\printtext[bibhyperref]{\printfield[citetitle:\strfield{entrysubtype}]{labeltitle}}\clearfield{title}}% {\iffieldequalstr{entrysubtype}{untitled}% {\printtext[bibhyperref]{\printfield[noformat]{labeltitle}}}% {\printtext[bibhyperref]{\printfield[citetitle:\strfield{entrytype}]{labeltitle}}}}}} \newbibmacro*{cite:mla:title}{% \ifnameundef{labelname}% {\usebibmacro{just:title:it}}% {\ifsingletitle% {}% {\usebibmacro{cite:mla:title:internal}}}% \ifthenelse{\iffieldequalstr{entrytype}{review}% \and\ifnameundef{author}% \and\iffieldundef{title}}% {\printtext[bibhyperref]% {\printtext{\bibcpstring{reviewof}% \setunit{\addspace}% \printfield{booktitle}}}}% {}% \setunit{\addspace}}% \newbibmacro*{cite:mla:title:internal}{% \ifbool{cbx@named}{\setunit{\addcomma\addspace}}{}% \iffieldundef{title}% {\iffieldequalstr{entrytype}{review}% {\printtext[bibhyperref]% {\printtext{\bibcpstring{reviewof}% \setunit{\addspace}% \printfield{booktitle}}}}% {\ifthenelse{\iffieldequalstr{entrytype}{suppbook}% \OR\iffieldequalstr{entrytype}{suppcollection}}% {\printtext[bibhyperref]{% \printfield[mla:capital]{entrysubtype}}}% {\iffieldundef{booktitle}% 2.0 fallback to print booktitle {}% {\printfield{booktitle}}% }}}% {\usebibmacro{just:title:it}}}% %%%%%%%%%%% for ibid, idem, opcit %%%%%%%% \newbibmacro*{cite:idem}{% \ifsingletitle% {\usebibmacro{cite:name}}% {\global\boolfalse{cbx@named}}} \newbibmacro*{cite:opcit}{% \usebibmacro{cite:mla:title}\setunit{\addspace}} \newbibmacro*{cite:ibid}{% \iffieldundef{postnote}% {\usebibmacro{cite:mla:noibid}}% 2.0 - check: add check here to see whether author should be printed? {\global\booltrue{cbx@hyperpages}}% \usebibmacro{cite:save}% \iffieldundef{prenote}% {}% {}}% 2.0 removed confusing attempt to disambiguate with prenotes \renewcommand*{\postnotedelim}{\addspace}% \renewbibmacro*{postnote}{% \iffieldundef{postnote}% {}% {\ifbool{cbx@hyperpages}% {\printtext[bibhyperref]{\printfield[ibidpostnote]{postnote}}}% {\printfield[ibidpostnote]{postnote}}}}% \newbibmacro*{locpostnote}{% \ifbool{cbx@mladraft}% {\ifbool{cbx@hyperpages}% {\printtext[mlarepeatedcites]{% \printtext[bibhyperref]{\printfield[ibidpostnote]{postnote}}}}% {\printtext[mlarepeatedcites]{% \printfield[ibidpostnote]{postnote}}}% \ifthenelse{\value{mladraftnote}<2}% {\mlasymbolfootnote{\addtocounter{mladraftnote}{4}% $\clubsuit$ It is best to cite once at the end % of a passage quoting a single page range.}}% {}}% {\usebibmacro{postnote}}} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%% Format Declarations %%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \DeclareFieldFormat{citetitle:article}{\mkbibquote{#1}} \DeclareFieldFormat{citetitle:inreference}{\mkbibquote{#1}} \DeclareFieldFormat{citetitle:book}{\mkbibemph{#1}} \DeclareFieldFormat{citetitle:bookinbook}{\mkbibemph{#1}}% NEW in 2.0 \DeclareFieldFormat{citetitle:booklet}{\mkbibemph{#1}}% \DeclareFieldFormat{citetitle:collection}{\mkbibemph{#1}}% \DeclareFieldFormat{citetitle:reference}{\mkbibemph{#1}}% \DeclareFieldFormat{citetitle:incollection}{\mkbibquote{#1}} \DeclareFieldFormat{citetitle:inbook}{\mkbibquote{#1}}% NEW in 2.0 \DeclareFieldFormat{citetitle:mvbook}{\mkbibemph{#1}}% NEW in 2.0 \DeclareFieldFormat{citetitle:online}{\mkbibquote{#1}}% \DeclareFieldFormat{citetitle:inproceedings}{\mkbibquote{#1}} \DeclareFieldFormat{citetitle:unpublished}{\mkbibquote{#1}} \DeclareFieldFormat{citetitle:thesis}{\mkbibquote{#1}} \DeclareFieldFormat{citetitle:video}{\mkbibemph{#1}} \DeclareFieldFormat{citetitle:review}{\mkbibquote{#1}}% \DeclareFieldFormat{mla:lowercase}{\MakeLowercase{#1}}% \DeclareFieldFormat[mlasource]{mla:unstyled}{#1\unspace}% \DeclareFieldFormat[mlasource]{mla:complete}{\mkbibemph{#1}\unspace}% \DeclareFieldFormat[mlasource]{mla:part}{\mkbibquote{#1}}% \DeclareFieldFormat{ibidpostnote}{#1}% \DeclareFieldFormat{footpostnote}{#1}% \DeclareFieldFormat{mlarepeatedcites}{\fbox{#1}% \marginpar{\hfill\footnotesize{$\clubsuit$}}}% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%% Cite Commands %%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \renewbibmacro*{prenote}{% \iffieldundef{prenote}% {\global\undef\cbx@lastprenote}% {\printfield{prenote}% \prenotedelim% \ifthenelse{\iffieldequals{prenote}{\cbx@lastprenote} \and \iffieldequals{entrykey}{\cbx@lastkey}}% {}% {}%\usebibmacro{cite:reset}}% 2.0 remove "clever" ibid reset with prenotes \savefield{prenote}{\cbx@lastprenote}}} \DeclareCiteCommand{\parencite}[\mkbibparens] {\usebibmacro{prenote}} {\usebibmacro{citeindex}% \usebibmacro{cite:mla}} {\multicitedelim} {\ifthenelse{\iffieldequals{postnote}{\cbx@lastpostnote} \and \iffieldequals{entrykey}{\cbx@lastkey}}% {\usebibmacro{locpostnote}}% {\usebibmacro{postnote}}% \savefield{postnote}{\cbx@lastpostnote}}% \DeclareCiteCommand*{\parencite}[\mkbibparens] {\global\undef\cbx@lasthash\usebibmacro{prenote}}% {\usebibmacro{citeindex}% \usebibmacro{cite:mla:starred:title}} {\multicitedelim} {\usebibmacro{postnote}} \newbibmacro{mla:prenote:see}{% Suggested by moewe on StackExchange \iffootnote {\iffieldundef{prenote} {\global\undef\cbx@lastprenote \printtext{See\addspace}} {\usebibmacro{prenote}}} {}} \DeclareCiteCommand{\cite}% {\usebibmacro{mla:prenote:see}}% {\usebibmacro{citeindex}% \usebibmacro{cite:mla}}% {\multicitedelim}% {\usebibmacro{postnote}} \DeclareCiteCommand{\textcite}% {\usebibmacro{mla:prenote:see}}% {\usebibmacro{citeindex}% \usebibmacro{cite:mla}}% {\multicitedelim}% {\usebibmacro{postnote}} \DeclareCiteCommand{\headlesscite}% {\usebibmacro{mla:prenote:see}}% {\usebibmacro{citeindex}% \usebibmacro{cite:mla:starred:title}} {\multicitedelim}% {\usebibmacro{postnote}} \DeclareCiteCommand*{\cite}% {\usebibmacro{mla:prenote:see}}% {\usebibmacro{citeindex}% \usebibmacro{cite:mla:starred:title}} {\multicitedelim}% {\usebibmacro{postnote}} \DeclareCiteCommand{\footcite}[\mkbibfootnote] {\bibsentence% \usebibmacro{cite:init}% \usebibmacro{prenote}} {\usebibmacro{citeindex}% \global\booltrue{cbx@mlafootnotes}% \renewcommand*{\newunitpunct}{\addcomma\space}% \usebibmacro{cite:mla:foot}} {\multicitedelim} {\usebibmacro{mla:foot:postnote}} \DeclareCiteCommand{\fullcite} {\usebibmacro{mla:prenote:see}}% {\usebibmacro{citeindex}% \usebibmacro{cite:mla:title}} {}% {\usebibmacro{postnote}} \DeclareCiteCommand{\headlessfullcite} {\usebibmacro{mla:prenote:see}}% {\usebibmacro{citeindex}% \usebibmacro{cite:mla:starred:title}} {}% {\usebibmacro{postnote}} \newbibmacro{mla:fullcite:prenote}{% \citereset\renewbibmacro*{author}{% \ifthenelse{\ifuseauthor\AND\NOT\ifnameundef{author}} {\DeclareNameAlias{author}{default}\ifthenelse{\iffieldequals{namehash}{\cbx@lasthash}\AND\NOT \iffirstonpage} {\mbox{\mlanamedash\unspace\newunitpunct}} {\printnames{author}% \savefield{namehash}{\cbx@lasthash}}} {\let\cbx@lasthash\undefined}}} \DeclareCiteCommand{\smartcite}[\iffootnote\mkbibparens\mkbibfootnote]% 2.0 changed to align with footcite {\bibsentence% \usebibmacro{cite:init}% \usebibmacro{prenote}} {\usebibmacro{citeindex}% \global\booltrue{cbx@mlafootnotes}% \renewcommand*{\newunitpunct}{\addcomma\space}% \usebibmacro{cite:mla:foot}} {\multicitedelim} {\usebibmacro{mla:foot:postnote}} \DeclareCiteCommand{\titleandsubtitle} {\boolfalse{citetracker}% \boolfalse{pagetracker}% \usebibmacro{prenote}} {\indexfield{indextitle}% \printtext[bibhyperref]{\printtext[citetitle]{% 2.0 added hyperref \printfield[noformat]{title}% \iffieldundef{subtitle}{}{\subtitlepunct}% \printfield[noformat]{subtitle}}}}% {\multicitedelim} {\usebibmacro{postnote}} \DeclareCiteCommand{\citeauthor}% {\usebibmacro{prenote}} {\ifciteindex {\indexnames{labelname}} {}% \printnames[given-family]{labelname}%FUTURE add check for citeseen (to print first name on first mention) } {\multicitedelim} {\usebibmacro{postnote}\usebibmacro{cite:save}} \DeclareCiteCommand*{\citeauthor}% {\usebibmacro{prenote}} {\ifciteindex {\indexnames{labelname}} {}% \printnames[family]{labelname}% % \ifentryseen{labelname}%FUTURE skeleton to check for first mention - doesn't work just now % {\printnames{labelname}}% TRUE % {\printnames[given-family]{labelname}}% FALSE } {\multicitedelim} {\usebibmacro{postnote}\usebibmacro{cite:save}} \DeclareCiteCommand{\citetitle} {\boolfalse{citetracker}% \boolfalse{pagetracker}% \usebibmacro{prenote}} {\ifciteindex {\indexfield{indextitle}} {}% \ifthenelse{\iffieldequalstr{entrytype}{unpublished}% \AND\NOT% \iffieldundef{entrysubtype}}% {\printfield[citetitle:\strfield{entrysubtype}]{labeltitle}}% {\printfield[citetitle]{labeltitle}}} {\multicitedelim} {\usebibmacro{postnote}} \DeclareCiteCommand*{\citetitle} {\boolfalse{citetracker}% \boolfalse{pagetracker}% \usebibmacro{prenote}} {\ifciteindex {\indexfield{indextitle}} {}% \ifthenelse{\iffieldequalstr{entrytype}{unpublished}% \AND\NOT% \iffieldundef{entrysubtype}}% {\printfield[citetitle:\strfield{entrysubtype}]{title}}% {\printfield[citetitle]{title}}}% {\multicitedelim} {\usebibmacro{postnote}} \newbibmacro*{cite:mla:starred:title}{% \ifciteibid {\iffieldundef{postnote} {\usebibmacro{cite:mla:title:alone}} {\global\booltrue{cbx@hyperpages}}} {\iffieldundef{shorthand} {\ifsingletitle% {\iffieldundef{postnote} {\usebibmacro{cite:mla:title:alone}} {\global\booltrue{cbx@hyperpages}}}% {\usebibmacro{cite:mla:title:alone}\setunit{\addspace}}} {\usebibmacro{cite:mla:shorthand}}}} \newbibmacro*{cite:mla:title:alone}{% \printtext[bibhyperref]{% suggested by StackExchange user Audrey \ifthenelse{% \iffieldequalstr{entrytype}{unpublished}\AND\NOT\iffieldundef{entrysubtype}% }% {\printfield[citetitle:\strfield{entrysubtype}]{labeltitle}}% {\ifthenelse{\iffieldequalstr{entrytype}{suppbook}\and\iffieldundef{title}}% {\printtext[bibhyperref]{% \printfield[mla:capital]{entrysubtype}}}% {\printfield[citetitle:\strfield{entrytype}]{labeltitle}}}% }% } \endinput