├── symbols.tex ├── draft.tex ├── final.tex ├── acknowledgements.tex ├── resources.tex ├── package.tex ├── note.tex ├── abstract.tex ├── paper.bib ├── README.md ├── macros.tex ├── Makefile ├── paper.tex ├── .gitignore ├── tips.tex ├── acmsiggraph.cls └── acmsiggraph.bst /symbols.tex: -------------------------------------------------------------------------------- 1 | \newcommand{\position}{\mathbf{p}} 2 | -------------------------------------------------------------------------------- /draft.tex: -------------------------------------------------------------------------------- 1 | \newcommand{\final}{0} 2 | \input{paper} 3 | -------------------------------------------------------------------------------- /final.tex: -------------------------------------------------------------------------------- 1 | \newcommand{\final}{1} 2 | \input{paper} 3 | -------------------------------------------------------------------------------- /acknowledgements.tex: -------------------------------------------------------------------------------- 1 | \section{Acknowledgements} 2 | I would like to thank all of my previous and current collaborators for inspirations of writing this article, especially Prof. Li-Yi Wei, from whom I have learned most of the tips mentioned here. 3 | -------------------------------------------------------------------------------- /resources.tex: -------------------------------------------------------------------------------- 1 | \section{Resources} 2 | 3 | Below are some references for further reading. 4 | 5 | \begin{itemize} 6 | \item 7 | Some suggestions for getting started with Latex. \url{http://nilesjohnson.net/latex.html} 8 | 9 | \item 10 | Jason Rennie's LaTeX tips and tricks. \url{http://qwone.com/~jason/latex/} 11 | 12 | \item 13 | General LATEX tips and tricks. \url{http://www.kronto.org/thesis/tips/} 14 | 15 | \item 16 | Some useful tips and tricks in LaTeX. \url{http://www.cse.iitd.ernet.in/~anup/homepage/UNIX/latex.html} 17 | 18 | \end{itemize} 19 | -------------------------------------------------------------------------------- /package.tex: -------------------------------------------------------------------------------- 1 | \usepackage{times,color} 2 | \usepackage{parskip} 3 | \usepackage{ifthen} 4 | \usepackage{float} 5 | \usepackage{alltt} 6 | \usepackage{mathenv} 7 | \usepackage{amsmath} 8 | \usepackage{amssymb} 9 | \usepackage{amsthm} 10 | \usepackage{newlfont} % for Box 11 | \usepackage{floatflt} 12 | \usepackage{wrapfig} 13 | \usepackage{fixltx2e} 14 | \usepackage{subfig} % for subfloat 15 | \usepackage{multirow} 16 | \usepackage{wasysym} 17 | \usepackage{booktabs} %for toprule, midrule, bottomrule in table 18 | %\usepackage{slashbox} %for toprule, midrule, bottomrule in table 19 | \usepackage{pdfpages} 20 | \usepackage{microtype} 21 | \usepackage{cleveref} 22 | \usepackage{enumitem} 23 | \usepackage{fancyvrb} 24 | -------------------------------------------------------------------------------- /note.tex: -------------------------------------------------------------------------------- 1 | \section{Blog} 2 | \label{sec:blog} 3 | \begin{description} 4 | \item[May 27, 2016] 5 | { 6 | \chongyang{Update abstract.}%chongyang 7 | } 8 | \item[May 25, 2016] 9 | { 10 | \chongyang{Use package fancyvrb for fancy verbatim.}%chongyang 11 | } 12 | \item[May 24, 2016] 13 | { 14 | \chongyang{Add section about comments and notes.}%chongyang 15 | } 16 | \item[May 23, 2016] 17 | { 18 | \chongyang{Add sections about source files and math symbols.} 19 | } 20 | \item[May 21, 2016] 21 | { 22 | \chongyang{ 23 | \begin{itemize} 24 | \item 25 | Start working on the document based on the official SIGGRAPH LaTeX template. 26 | 27 | \item 28 | Add section about BibTeX Items. 29 | 30 | \end{itemize} 31 | }%chongyang 32 | } 33 | \end{description} 34 | -------------------------------------------------------------------------------- /abstract.tex: -------------------------------------------------------------------------------- 1 | \begin{abstract} 2 | LaTeX has been widely used to write research papers. 3 | Unlike most popular articles which have introduced various LaTeX syntax and tricks to achieve the desired effects and formats in the compiled \emph{output}, in this document I will suggest some tips about how to write and organize these \emph{input} LaTeX source files. 4 | While having little impact on the final result, these tips may be helpful to maintain the LaTeX source and thus facilitate research collaborations. 5 | This document is based on my personal experience of writing papers in the field of computer graphics and thus may not apply to other fields. 6 | The LaTeX source of this document is available at \url{https://github.com/chongyangma/LaTeXTips}. 7 | %Some references for further reading are also included in the document. 8 | \end{abstract} 9 | -------------------------------------------------------------------------------- /paper.bib: -------------------------------------------------------------------------------- 1 | @article{Ma:2013:DET, 2 | author = {Chongyang Ma and Li-Yi Wei and Sylvain Lefebvre and Xin Tong}, 3 | title = {Dynamic Element Textures}, 4 | journal = {ACM Transactions on Graphics}, 5 | volume = {32}, 6 | issue = {4}, 7 | year = {2013}, 8 | pages = {90:1--90:10}, 9 | } 10 | 11 | @article{Ma:2011:DET, 12 | author = {Chongyang Ma and Li-Yi Wei and Xin Tong}, 13 | title = {Discrete Element Textures}, 14 | journal = {ACM Transactions on Graphics}, 15 | volume = {30}, 16 | issue = {4}, 17 | year = {2011}, 18 | pages = {62:1--10}, 19 | } 20 | 21 | @article{Ma:2009:MFT, 22 | author = {Chongyang Ma and Li-Yi Wei and Baining Guo and Kun Zhou}, 23 | title = {Motion Field Texture Synthesis}, 24 | journal = {ACM Transactions on Graphics}, 25 | volume = {28}, 26 | issue = {5}, 27 | year = {2009}, 28 | pages = {110:1--8}, 29 | } 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # LaTeXTips 2 | Some LaTeX Tips for Writing Research Papers 3 | 4 | Author: _Chongyang Ma_ 5 | 6 | Email: chongyangm@gmail.com 7 | 8 | ## Abstract 9 | LaTeX has been widely used to write research papers. Unlike most popular articles which have introduced various LaTeX syntax and tricks to achieve the desired effects and formats in the compiled _output_, in this document I will suggest some tips about how to write and organize these _input_ LaTeX source files. While having little impact on the final result, these tips may be helpful to maintain the LaTeX source and thus facilitate research collaborations. This document is based on my personal experience of writing papers in the field of computer graphics and thus may not apply to other fields. 10 | 11 | ## Compilation 12 | Compile either _final.tex_ or _draft.tex_ using PDFLaTeX to get the version without or with notes. 13 | -------------------------------------------------------------------------------- /macros.tex: -------------------------------------------------------------------------------- 1 | \definecolor{ChongyangColor}{rgb}{0.7,0,0} 2 | \newcommand{\chongyang}[1]{{\color{ChongyangColor} Chongyang: #1}} 3 | \newcommand{\note}[1]{{\it\color{blue} #1}} 4 | \newcommand{\filename}[1]{{\color{blue}\em #1}} 5 | \newcommand{\commentout}[1]{} % this command is used to comment out multiple lines easily 6 | 7 | \commentout{ 8 | These lines 9 | won't appear 10 | in the compile output. 11 | }%commentout 12 | 13 | \newcommand{\psdraftboxDefault}{\psnodraftbox} 14 | 15 | \ifthenelse{\equal{\final}{1}} 16 | { 17 | \renewcommand{\chongyang}[1]{} 18 | \renewcommand{\note}[1]{} 19 | } 20 | {} 21 | 22 | \DefineVerbatimEnvironment{latexexample} 23 | {Verbatim} 24 | {fontsize=\normalsize,formatcom=\color{red}} 25 | 26 | \hyphenpenalty=1000 % magic number to reduce ugly line breaks 27 | 28 | \linespread{1.1} % this line should be commented out to follow the format standards of SIGGRAPH submission/publication 29 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | DRAFT = draft 2 | FINAL = final 3 | 4 | BIB_SOURCES = paper.bib 5 | 6 | PAPER_SOURCES = paper.tex abstract.tex tips.tex 7 | DRAFT_SOURCES = draft.tex $(PAPER_SOURCES) 8 | FINAL_SOURCES = final.tex $(PAPER_SOURCES) 9 | 10 | TEX = pdflatex -interaction nonstopmode 11 | BIB = bibtex 12 | 13 | all: $(DRAFT).pdf $(FINAL).pdf 14 | 15 | $(DRAFT).pdf : $(DRAFT_SOURCES) $(DRAFT).bbl 16 | $(TEX) $(DRAFT) 17 | $(TEX) $(DRAFT) 18 | 19 | $(DRAFT).aux : $(DRAFT_SOURCES) 20 | $(TEX) $(DRAFT) 21 | 22 | $(DRAFT).bbl : $(DRAFT_SOURCES) $(BIB_SOURCES) $(DRAFT).aux 23 | $(BIB) $(DRAFT) 24 | 25 | $(FINAL).pdf : $(FINAL_SOURCES) $(FINAL).bbl 26 | $(TEX) $(FINAL) 27 | $(TEX) $(FINAL) 28 | 29 | $(FINAL).aux : $(FINAL_SOURCES) 30 | $(TEX) $(FINAL) 31 | 32 | $(FINAL).bbl : $(FINAL_SOURCES) $(BIB_SOURCES) $(FINAL).aux 33 | $(BIB) $(FINAL) 34 | 35 | clean: 36 | rm -f $(DRAFT).pdf $(DRAFT).out $(DRAFT).dvi $(DRAFT).bbl $(DRAFT).aux $(DRAFT).blg $(DRAFT).log $(FINAL).pdf $(FINAL).out $(FINAL).dvi $(FINAL).bbl $(FINAL).aux $(FINAL).blg $(FINAL).log 37 | -------------------------------------------------------------------------------- /paper.tex: -------------------------------------------------------------------------------- 1 | \documentclass[tog]{acmsiggraph} 2 | \NeedsTeXFormat{LaTeX2e} 3 | \input{package} 4 | \input{macros} 5 | \input{symbols} 6 | 7 | \ifreviewelse{\renewcommand{\final}{1}}{} 8 | 9 | \graphicspath{ 10 | {figs/} 11 | {figs/raster/} 12 | } 13 | 14 | \TOGonlineid{papers\_0123} 15 | \TOGvolume{0} 16 | \TOGnumber{0} 17 | 18 | %\title{Some \LaTeX\ Tips and Tricks for Writing Research Papers} 19 | \title{Some LaTeX Tips for Writing Research Papers} 20 | 21 | \author{Chongyang Ma\thanks{chongyangm@gmail.com}} 22 | 23 | \pdfauthor{Chongyang Ma} 24 | 25 | %\keywords{LaTeX} 26 | 27 | \begin{document} 28 | 29 | %\input{teaser_fig} 30 | 31 | \maketitle 32 | 33 | \input{abstract} 34 | \input{tips} 35 | \input{acknowledgements} 36 | %\input{resources} 37 | 38 | \bibliographystyle{acmsiggraph} 39 | { 40 | %\setlength{\topsep}{0ex} 41 | %\setlength{\itemsep}{0ex} 42 | %\setlength{\partopsep}{0ex} 43 | %\setlength{\parsep}{0ex} 44 | %\setlength{\parskip}{1ex} 45 | 46 | \bibliography{paper} 47 | } 48 | 49 | \appendix 50 | \normalsize 51 | 52 | \ifthenelse{\equal{\final}{0}} 53 | { 54 | \cleardoublepage 55 | \pagenumbering{alph} 56 | 57 | \input{note} 58 | } 59 | {} 60 | 61 | \end{document} 62 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Core latex/pdflatex auxiliary files: 2 | *.aux 3 | *.lof 4 | *.log 5 | *.lot 6 | *.fls 7 | *.out 8 | *.toc 9 | *.fmt 10 | *.fot 11 | *.cb 12 | *.cb2 13 | 14 | ## Intermediate documents: 15 | *.dvi 16 | *-converted-to.* 17 | # these rules might exclude image files for figures etc. 18 | # *.ps 19 | # *.eps 20 | # *.pdf 21 | 22 | ## Bibliography auxiliary files (bibtex/biblatex/biber): 23 | *.bbl 24 | *.bcf 25 | *.blg 26 | *-blx.aux 27 | *-blx.bib 28 | *.brf 29 | *.run.xml 30 | 31 | ## Build tool auxiliary files: 32 | *.fdb_latexmk 33 | *.synctex 34 | *.synctex.gz 35 | *.synctex.gz(busy) 36 | *.pdfsync 37 | 38 | ## Auxiliary and intermediate files from other packages: 39 | # algorithms 40 | *.alg 41 | *.loa 42 | 43 | # achemso 44 | acs-*.bib 45 | 46 | # amsthm 47 | *.thm 48 | 49 | # beamer 50 | *.nav 51 | *.snm 52 | *.vrb 53 | 54 | # cprotect 55 | *.cpt 56 | 57 | # fixme 58 | *.lox 59 | 60 | #(r)(e)ledmac/(r)(e)ledpar 61 | *.end 62 | *.?end 63 | *.[1-9] 64 | *.[1-9][0-9] 65 | *.[1-9][0-9][0-9] 66 | *.[1-9]R 67 | *.[1-9][0-9]R 68 | *.[1-9][0-9][0-9]R 69 | *.eledsec[1-9] 70 | *.eledsec[1-9]R 71 | *.eledsec[1-9][0-9] 72 | *.eledsec[1-9][0-9]R 73 | *.eledsec[1-9][0-9][0-9] 74 | *.eledsec[1-9][0-9][0-9]R 75 | 76 | # glossaries 77 | *.acn 78 | *.acr 79 | *.glg 80 | *.glo 81 | *.gls 82 | *.glsdefs 83 | 84 | # gnuplottex 85 | *-gnuplottex-* 86 | 87 | # hyperref 88 | *.brf 89 | 90 | # knitr 91 | *-concordance.tex 92 | # TODO Comment the next line if you want to keep your tikz graphics files 93 | *.tikz 94 | *-tikzDictionary 95 | 96 | # listings 97 | *.lol 98 | 99 | # makeidx 100 | *.idx 101 | *.ilg 102 | *.ind 103 | *.ist 104 | 105 | # minitoc 106 | *.maf 107 | *.mlf 108 | *.mlt 109 | *.mtc 110 | *.mtc[0-9] 111 | *.mtc[1-9][0-9] 112 | 113 | # minted 114 | _minted* 115 | *.pyg 116 | 117 | # morewrites 118 | *.mw 119 | 120 | # mylatexformat 121 | *.fmt 122 | 123 | # nomencl 124 | *.nlo 125 | 126 | # sagetex 127 | *.sagetex.sage 128 | *.sagetex.py 129 | *.sagetex.scmd 130 | 131 | # sympy 132 | *.sout 133 | *.sympy 134 | sympy-plots-for-*.tex/ 135 | 136 | # pdfcomment 137 | *.upa 138 | *.upb 139 | 140 | # pythontex 141 | *.pytxcode 142 | pythontex-files-*/ 143 | 144 | # thmtools 145 | *.loe 146 | 147 | # TikZ & PGF 148 | *.dpth 149 | *.md5 150 | *.auxlock 151 | 152 | # todonotes 153 | *.tdo 154 | 155 | # xindy 156 | *.xdy 157 | 158 | # xypic precompiled matrices 159 | *.xyc 160 | 161 | # endfloat 162 | *.ttt 163 | *.fff 164 | 165 | # Latexian 166 | TSWLatexianTemp* 167 | 168 | ## Editors: 169 | # WinEdt 170 | *.bak 171 | *.sav 172 | 173 | # Texpad 174 | .texpadtmp 175 | 176 | # Kile 177 | *.backup 178 | 179 | # KBibTeX 180 | *~[0-9]* 181 | -------------------------------------------------------------------------------- /tips.tex: -------------------------------------------------------------------------------- 1 | \section{LaTeX Source} 2 | \label{sec:source} 3 | 4 | \subsection{Source Files} 5 | 6 | Writing paper using LaTeX for a project is just like coding. Therefore, it is usually helpful to maintain the LaTeX source files following some coding standards. 7 | I suggest to keep the LaTeX source of each section as an individual file. This will make the file/section organization clearer and can facilitate the search of a certain part of LaTeX source. 8 | I even put the LaTeX source of each figure into an individual file. This is particularly useful when I need to tweak the figure location and layout. 9 | 10 | It is also helpful to separate the LaTeX source of each paragraph into multiple lines with hard returns, instead of using SPACE to separate sentences or relying on any text editor. 11 | The compiled pdf file will look the same in both ways, but the former makes it much easier for most version control tools to track changes and thus avoid potential conflict when several coauthors happen to work on the same part. 12 | 13 | \subsection{Math Symbols} 14 | 15 | It is recommended to define math symbols using ``\verb|\newcommand|''. 16 | For example, instead of using ``\verb|\mathbf{p}|'' everywhere for a vector representing a position, I will first declare a ``position'' command in \filename{symbols.tex} as below: 17 | \begin{latexexample} 18 | \newcommand{\position}{\mathbf{p}} 19 | \end{latexexample} 20 | Then I will use ``\verb|\position|'' in the main text. 21 | This way of symbol declaration can make the LaTeX source more intuitive to understand/edit and will make it much easier to change the forms of these symbols. 22 | 23 | \subsection{Comments and Notes} 24 | 25 | During the process of paper writing, it is usually desirable to add some comments and notes into the paper draft to help communication between coauthors, which should not appear in the final submission/publication. 26 | One simple way to achieve this goal is to define two versions of the paper. See \filename{draft.tex} and \filename{final.tex} for concrete examples. 27 | In \filename{draft.tex}, we have: 28 | \begin{latexexample} 29 | \newcommand{\final}{0} 30 | \input{paper} 31 | \end{latexexample} 32 | while \filename{final.tex} contains the following LaTeX source: 33 | \begin{latexexample} 34 | \newcommand{\final}{1} 35 | \input{paper} 36 | \end{latexexample} 37 | Both of these two files include the same LaTeX source \filename{paper.tex} as the main text of the paper. The only difference between these two files is the value of the command ``\verb|\final|'', one is $0$ while the other is $1$. 38 | Compiling \filename{draft.tex} will generate the version with comments and notes for internal use (see the Blog section at the end of the compiled \filename{draft.pdf}), while compiling \filename{final.tex} will generate the version for submission/publication without comments and notes. 39 | The trick here is to define and redefine certain commands in \filename{macros.tex}, such as ``\verb|\note|'', based on the value of command ``\verb|\final|'' as follows: 40 | \begin{latexexample} 41 | \newcommand{\note}[1]{{\it\color{blue} #1}} 42 | \ifthenelse{\equal{\final}{1}} 43 | { 44 | \renewcommand{\note}[1]{} 45 | } 46 | {} 47 | \end{latexexample} 48 | Then we can use ``\verb|\note{some comments}|'' to add some internal comments into the paper, which will be visible only in the draft mode. 49 | 50 | \subsection{BibTeX Items} 51 | 52 | One of the most common mistakes about a list of BibTeX items is duplicated entries. 53 | To reduce the chance of having duplicated entries, I always keep the items in a chronological order with a unified and informative format for the entry names. Specifically, I follow the BibTeX naming convention in the ACM Digital Library but remove the doi string to keep it short. 54 | Then the entry name of a reference will be something like ``XXX:YYYY:ABC'', where ``XXX'' is the last name of the first author, ``YYYY'' is the publication year, and ``ABC'' is an abbreviation of the paper title. For example, the bib entry name of \cite{Ma:2011:DET} will be ``Ma:2011:DET''. 55 | See \filename{paper.bib} for some concrete examples. 56 | -------------------------------------------------------------------------------- /acmsiggraph.cls: -------------------------------------------------------------------------------- 1 | % 2 | % acmsiggraph.cls 3 | % 4 | % version history 5 | % 6 | % - borrows *heavily* from Daniel Kartch's 'siggraph' class. 7 | % - also uses pieces of 'apalike.sty' and 'authordate1-4.cls' 8 | % - modifications include adjustment of citation format to more closely 9 | % align with new (for SIGGRAPH 2002 conference and beyond) reference 10 | % and citation formatting requirements. 11 | % - version 0.1 2001/06/01 Stephen Spencer (spencer@acm.org) 12 | % - version 0.2 2001/10/15 Stephen Spencer 13 | % - the "\onlineid" variable works with the "review" mode, placing a 14 | % banner across the top of each page "Online Submission ID 'onlineid' 15 | % - version 0.3 2002/01/11 Stephen Spencer 16 | % - disabled the cover page option. 17 | % - version 0.4 2002/01/23 Stephen Spencer 18 | % - based on suggestions from James O'Brien, the following changes: 19 | % - correction if '\ifcamera' and '\ifcameraelse' commands 20 | % - page numbering in both review and preprint modes 21 | % have been made. 22 | % - version 0.5 2005/01/22 Stephen Spencer 23 | % - removed the category markers 24 | % - version 0.6 2006/12/15 Stephen Spencer 25 | % - tightened up space around section headings 26 | % - version 0.7 2008/10/21 Stephen Spencer 27 | % - added 'annualconference' parameter for copyright space 28 | % - added line number support for 'review' mode 29 | % - version 0.8 2011/03/02 Stephen Spencer (with Hugues Hoppe) 30 | % - removal of 'widereview' mode 31 | % - added hyperref 32 | % - added URL Links for paper DOI and author-provided content. 33 | % - version 0.81 2012/01/03 Stephen Spencer 34 | % - bugfix: returned the "amsmath" package requirement, which 35 | % resolves the line-numbering issue (thank you, Sylvain Paris 36 | % and Hanspeter Pfister) 37 | % - version 0.82 2012/01/05 Stephen Spencer 38 | % - bugfix: added ``breaklinks=true'' to hyperref setup 39 | % - version 0.9 2013/12/06 Stephen Spencer 40 | % - removed "abstract" environment for copyright space 41 | % - renamed remaining environments to "tog" and "conference" 42 | % - version 0.91 43 | % - removed the hyperlink icons 44 | % - added date to the external class name 45 | % 46 | % --------------------------------------------------------------------------- 47 | 48 | \NeedsTeXFormat{LaTeX2e} 49 | \ProvidesClass{acmsiggraph}[2014/12/29 ACM SIGGRAPH class] 50 | 51 | % lots of options aren't allowed. 52 | 53 | \DeclareOption{onecolumn}{\OptionNotUsed} 54 | \DeclareOption{a4paper}{\OptionNotUsed} 55 | \DeclareOption{12pt}{\OptionNotUsed} 56 | \DeclareOption{14pt}{\OptionNotUsed} 57 | 58 | % options that we DO want to set. 59 | 60 | \newlength{\ACMpointsize} 61 | \setlength{\ACMpointsize}{9pt} 62 | 63 | % ``documentclass'' options. 64 | 65 | \newif\if@ACMtog 66 | \@ACMtogfalse 67 | \DeclareOption{tog}{\@ACMtogtrue} 68 | 69 | \newif\if@ACMconference 70 | \@ACMconferencefalse 71 | \DeclareOption{conference}{\@ACMconferencetrue} 72 | 73 | \newif\if@ACMreview 74 | \@ACMreviewfalse 75 | \DeclareOption{review}{\@ACMreviewtrue} 76 | 77 | \newif\if@ACMpreprint 78 | \@ACMpreprintfalse 79 | \DeclareOption{preprint}{\@ACMpreprinttrue} 80 | 81 | % pass the options, and load the 'article' class, on which 'acmsiggraph' 82 | % is based. 83 | 84 | \ProcessOptions\relax 85 | \LoadClass[twocolumn,letterpaper]{article} 86 | 87 | % required packages. 88 | 89 | \RequirePackage{amsmath} 90 | \RequirePackage{lineno} 91 | \RequirePackage[scaled=.92]{helvet} 92 | \RequirePackage{times} 93 | \RequirePackage{graphicx} 94 | \RequirePackage[labelfont=bf,textfont=it]{caption} 95 | \RequirePackage{parskip} 96 | 97 | % define things. 98 | 99 | \setlength{\textheight}{9.250in} 100 | \setlength{\textwidth}{7.000in} 101 | \setlength{\topmargin}{-0.700in} 102 | \setlength{\oddsidemargin}{-0.250in} 103 | \setlength{\evensidemargin}{-0.250in} 104 | \setlength{\columnsep}{2pc} 105 | \setlength{\headheight}{0.200in} 106 | \setlength{\headsep}{0.250in} 107 | \setlength{\footskip}{0.500in} 108 | 109 | \DeclareRobustCommand\cs[1]{\texttt{\char`\\#1}} 110 | 111 | % create a new length ``\ACMcopyrightspace'' and set its initial value. 112 | 113 | \newlength{\ACMcopyrightspace} 114 | \setlength{\ACMcopyrightspace}{3.3in} 115 | 116 | % set the value of ``\ACMcopyrightspace'' based on the kind of document. 117 | 118 | \if@ACMtog 119 | \setlength{\ACMcopyrightspace}{1.5in} 120 | \fi 121 | 122 | \if@ACMconference 123 | \setlength{\ACMcopyrightspace}{1.0in} 124 | \fi 125 | 126 | \if@ACMreview 127 | \setlength{\ACMcopyrightspace}{0in} 128 | \fi 129 | 130 | \if@ACMpreprint 131 | \setlength{\ACMcopyrightspace}{0in} 132 | \fi 133 | 134 | % define the ``\copyrightspace'' command. 135 | % (todo) don't do this if ``\ACMcopyrightspace'' is zero. 136 | 137 | \newcommand{\copyrightspace}{% 138 | \renewcommand{\thefootnote}{}% 139 | \footnotetext[0]{\rule[\ACMcopyrightspace]{2.71828in}{0in}}% 140 | \renewcommand{\thefootnote}{\arabic{footnote}} 141 | } 142 | 143 | % in ``review'' mode, the ``\onlineid'' command passes the value given 144 | % to the paper by the online submission system. This gets printed out 145 | % at the top of each page. 146 | 147 | \newcommand{\TOGonlineid}[1]{\gdef\@ACMonlineid{#1}} 148 | \newcommand{\@ACMreviewtext}{Online Submission ID: \@ACMonlineid} 149 | 150 | % in ``preprint'' mode, the ``\TOGvolume'' and ``\TOGnumber'' commands 151 | % pass the volume and number of the TOG issue in which the paper will be 152 | % published. This gets printed out at the top of each page. 153 | 154 | \newcommand{\TOGvolume}[1]{\gdef\@ACMvolume{#1}} 155 | \newcommand{\TOGnumber}[1]{\gdef\@ACMnumber{#1}} 156 | \newcommand{\@ACMpreprinttext}{To appear in ACM TOG \@ACMvolume(\@ACMnumber).} 157 | 158 | %%% 159 | 160 | \newcommand{\ifreview}[1]{\if@ACMreview #1 \fi} 161 | \newcommand{\ifreviewelse}[2]{\if@ACMreview #1 \else #2 \fi} 162 | 163 | %%% 164 | 165 | \newcommand{\@ACMarticleDOI}{} % of the form 1073204.1073261 166 | \newcommand{\@ACMarticleDOIsuffix}{} % of the form 1073261 167 | 168 | \def\@ACMgetDOIsuffix#1.#2\@nil{#2} 169 | 170 | \newcommand{\TOGarticleDOI}[1]{% 171 | \renewcommand{\@ACMarticleDOI}{#1} 172 | \in@{.}{#1}% given DOI of the form 1073204.1073261, if there is a period, extract the second part 173 | \ifin@ 174 | \renewcommand{\@ACMarticleDOIsuffix}{\@ACMgetDOIsuffix#1\@nil} 175 | \else 176 | \renewcommand{\@ACMarticleDOIsuffix}{#1} 177 | \fi 178 | } 179 | 180 | %%% 181 | 182 | \newcommand{\pdfauthor}[1]{\gdef\@ACMpdfauthor{#1}} 183 | 184 | % if we are in ``review'' or ``preprint'' modes, set up special headers 185 | % and footers for each page of the paper. 186 | 187 | \renewcommand{\ps@plain}% 188 | {% 189 | \renewcommand{\@oddhead}{}% 190 | \renewcommand{\@oddfoot}{}% 191 | 192 | \if@ACMpreprint% 193 | \renewcommand{\@oddhead}{\hfil\textit{\large\@ACMpreprinttext}\hfil}% 194 | \renewcommand{\@oddfoot}{\hfil\textrm{\thepage}\hfil}% 195 | \fi% 196 | 197 | \if@ACMreview% 198 | \renewcommand{\@oddhead}{\hfil\textit{\large\@ACMreviewtext}\hfil}% 199 | \renewcommand{\@oddfoot}{\hfil\textrm{\thepage}\hfil}% 200 | \fi% 201 | 202 | \renewcommand{\@evenhead}{\@oddhead}% 203 | \renewcommand{\@evenfoot}{\@oddfoot}% 204 | } 205 | 206 | \renewcommand{\ps@empty}% 207 | {% 208 | \renewcommand{\@oddhead}{}% 209 | \renewcommand{\@oddfoot}{}% 210 | 211 | \if@ACMpreprint% 212 | \renewcommand{\@oddhead}{\hfil\textit{\large\@ACMpreprinttext}\hfil}% 213 | \renewcommand{\@oddfoot}{\hfil\textrm{\thepage}\hfil}% 214 | \fi% 215 | 216 | \if@ACMreview% 217 | \renewcommand{\@oddhead}{\hfil\textit{\large\@ACMreviewtext}\hfil}% 218 | \renewcommand{\@oddfoot}{\hfil\textrm{\thepage}\hfil}% 219 | \fi% 220 | 221 | \renewcommand{\@evenhead}{\@oddhead}% 222 | \renewcommand{\@evenfoot}{\@oddfoot}% 223 | } 224 | 225 | % no page numbers! 226 | 227 | \pagestyle{plain} 228 | 229 | % if we are in ``review'' mode, turn on line numbers. 230 | 231 | \if@ACMreview% 232 | \linenumbers 233 | \fi 234 | 235 | % Nine-point type is the standard. 236 | 237 | \newcommand{\@ACMsetninepoint}{ 238 | \renewcommand\normalsize{% 239 | \@setfontsize\normalsize\@ixpt\@xpt 240 | \abovedisplayskip 9\p@ \@plus2\p@ \@minus4\p@ 241 | \abovedisplayshortskip \z@ \@plus3\p@ 242 | \belowdisplayshortskip 6\p@ \@plus3\p@ \@minus3\p@ 243 | \belowdisplayskip \abovedisplayskip 244 | \let\@listi\@listI} 245 | \renewcommand\small{% 246 | \@setfontsize\small\@viipt\@ixpt 247 | \abovedisplayskip 8.5\p@ \@plus3\p@ \@minus4\p@ 248 | \abovedisplayshortskip \z@ \@plus2\p@ 249 | \belowdisplayshortskip 4\p@ \@plus2\p@ \@minus2\p@ 250 | \def\@listi{\leftmargin\leftmargini 251 | \topsep 4\p@ \@plus2\p@ \@minus2\p@ 252 | \parsep 2\p@ \@plus\p@ \@minus\p@ 253 | \itemsep \parsep}% 254 | \belowdisplayskip \abovedisplayskip} 255 | \renewcommand\footnotesize{% 256 | \@setfontsize\footnotesize\@viiipt{9.5}% 257 | \abovedisplayskip 6\p@ \@plus2\p@ \@minus4\p@ 258 | \abovedisplayshortskip \z@ \@plus\p@ 259 | \belowdisplayshortskip 3\p@ \@plus\p@ \@minus2\p@ 260 | \def\@listi{\leftmargin\leftmargini 261 | \topsep 3\p@ \@plus\p@ \@minus\p@ 262 | \parsep 2\p@ \@plus\p@ \@minus\p@ 263 | \itemsep \parsep}% 264 | \belowdisplayskip \abovedisplayskip} 265 | \renewcommand\scriptsize{\@setfontsize\scriptsize\@viipt\@viiipt} 266 | \renewcommand\tiny{\@setfontsize\tiny\@vpt\@vipt} 267 | \renewcommand\large{\@setfontsize\large\@xpt\@xiipt} 268 | \renewcommand\Large{\@setfontsize\Large\@xiipt{14}} 269 | \renewcommand\LARGE{\@setfontsize\LARGE\@xivpt{18}} 270 | \renewcommand\huge{\@setfontsize\huge\@xviipt{22}} 271 | \renewcommand\Huge{\@setfontsize\Huge\@xxpt{25}} 272 | \selectfont 273 | } 274 | 275 | \@ACMsetninepoint 276 | 277 | % Section and subsection environment tweaks. 278 | 279 | \newcommand{\@ACMsectionfont}{} 280 | \newcommand{\sectionfont}[1]{\renewcommand{\@ACMsectionfont}{#1}} 281 | \renewcommand\section{\@startsection {section}{1}{\z@}% 282 | {-1.0ex}% 283 | {1.0ex}% 284 | {\reset@font\Large\sffamily\bfseries\@ACMsectionfont}} 285 | \renewcommand\subsection{\@startsection{subsection}{2}{\z@}% 286 | {-1.0ex}% 287 | {1.0ex}% 288 | {\reset@font\large\sffamily\bfseries\@ACMsectionfont}} 289 | \renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}% 290 | {-1.0ex}% 291 | {1.0ex}% 292 | {\reset@font\normalsize\sffamily\bfseries\@ACMsectionfont}} 293 | 294 | % Paragraph and subparagraph environment tweaks. 295 | 296 | \renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}% 297 | {2.05ex}% 298 | {-1em}% 299 | {\reset@font\normalsize\sffamily\bfseries\@ACMsectionfont}} 300 | \renewcommand\subparagraph{\@startsection{subparagraph}{5}{\parindent}% 301 | {3.25ex \@plus1ex \@minus .2ex}% 302 | {-1em}% 303 | {\reset@font\normalsize\sffamily\bfseries\@ACMsectionfont}} 304 | 305 | % no labels in bibliography. 306 | 307 | \def\@biblabel#1{} 308 | 309 | % bibitems are flush left, with successive lines indented by 1em. 310 | 311 | \newlength{\bibhang} 312 | \setlength{\bibhang}{1em} 313 | 314 | \def\thebibliography#1{% 315 | \section*{% 316 | \refname\@mkboth{\sl\uppercase{\refname}}{\sl\uppercase{\refname}}} 317 | \list{\relax}{\setlength{\labelsep}{0em} 318 | \setlength{\itemindent}{-\bibhang} 319 | \setlength{\leftmargin}{\bibhang}} 320 | \def\newblock{\hskip .11em plus .33em minus .07em} 321 | \sloppy\clubpenalty4000\widowpenalty4000 322 | \sfcode`\.=1000\relax} 323 | 324 | \def\@citex[#1]#2{\if@filesw\immediate\write\@auxout{\string\citation{#2}}\fi 325 | \def\@citea{}\@cite{\@for\@citeb:=#2\do 326 | {\@citea\def\@citea{; }\@ifundefined 327 | {b@\@citeb}{{\bf ?}\@warning 328 | {Citation '\@citeb' on page \thepage \space undefined}}% 329 | {\csname b@\@citeb\endcsname}}}{#1}} 330 | 331 | \let\@internalcite\cite 332 | \def\cite{\def\citename##1{##1}\@internalcite} 333 | \def\shortcite{\def\citename##1{}\@internalcite} 334 | 335 | % title stuff... 336 | 337 | \newcommand{\@ACMempty}{} 338 | 339 | \newcommand{\@ACMaffiliation}{} 340 | \newcommand{\affiliation}[1]{\gdef\@ACMaffiliation{#1}} 341 | 342 | \newcommand{\@ACMteaser}{} 343 | \newcommand{\teaser}[1]{\gdef\@ACMteaser{#1}} 344 | 345 | \newlength{\titlespace} 346 | \setlength{\titlespace}{0.25in} 347 | 348 | \newlength{\teaserspace} 349 | \setlength{\teaserspace}{0.25in} 350 | 351 | \if@ACMreview 352 | \renewcommand{\@maketitle}{% 353 | \begin{center}% 354 | \renewcommand{\thanks}[1]{} 355 | {\LARGE\sffamily\bfseries\@ACMsectionfont \@title \par}% 356 | \vspace{1\baselineskip}% 357 | \vspace{\titlespace}% 358 | \ifx\@ACMteaser\@ACMempty \else% 359 | \begingroup% 360 | \def\@captype{figure}% 361 | \@ACMteaser% 362 | \endgroup\par% 363 | \vspace{\teaserspace}% 364 | \fi% 365 | \end{center} \par% 366 | } 367 | \else 368 | \renewcommand{\@maketitle}{% 369 | \begin{center}% 370 | {\LARGE\sffamily\bfseries\@ACMsectionfont \@title \par}% 371 | \vspace{1\baselineskip}% 372 | \large 373 | \begin{tabular}[t]{c}% 374 | \@author 375 | \end{tabular}\par% 376 | \ifx\@ACMaffiliation\@ACMempty \else% 377 | \vspace{0.5\baselineskip}% 378 | \@ACMaffiliation\par% 379 | \fi% 380 | \vspace{\titlespace}% 381 | \ifx\@ACMteaser\@ACMempty \else% 382 | \begingroup% 383 | \def\@captype{figure}% 384 | \@ACMteaser% 385 | \endgroup\par% 386 | \vspace{\teaserspace}% 387 | \fi% 388 | \end{center} \par% 389 | } 390 | \fi 391 | 392 | \let\@ACMorigmaketitle\maketitle 393 | \let\@ACMorigand\and 394 | \renewcommand{\maketitle}{% 395 | \let\@ACMtitle\@title% 396 | \let\@ACMauthor\@author% 397 | \@ACMorigmaketitle% 398 | \thispagestyle{empty}% 399 | } 400 | 401 | % Abstract stuff... 402 | 403 | \newtoks\@ACMabs 404 | \if@ACMreview 405 | \long\def\@ACMadd#1{\global\@ACMabs\expandafter{\the\@ACMabs#1}} 406 | \long\def\@ACMcollect{% 407 | \global\@ACMabs{}% 408 | \let\abstract\@ACM@collect 409 | \abstract 410 | } 411 | \long\def\@ACM@collect#1\end#2{% 412 | \def\@tempa{#2}% 413 | \ifx\@tempa\@currenvir 414 | \@ACMadd{#1}% 415 | \edef\abstract{\noexpand\end{\@tempa}}% 416 | \else 417 | \@ACMadd{#1\end{#2}}% 418 | \fi 419 | \abstract 420 | } 421 | \newcommand{\@ACMmodify}{% 422 | \let\@ACMorigabs\abstract% 423 | \let\@ACMorigendabs\endabstract% 424 | \renewenvironment{abstract}% 425 | {\@ACMcollect}% 426 | {\begingroup 427 | \let\abstract\@ACMorigabs 428 | \let\endabstract\@ACMorigendabs 429 | \begin{abstract} \the\@ACMabs \end{abstract} 430 | \endgroup}% 431 | } 432 | \AtBeginDocument{\@ACMmodify} 433 | \fi 434 | 435 | %%% Keyword list. 436 | 437 | \newcommand{\@ACMkeywords}{} 438 | \newcommand{\keywords}[1]{\renewcommand{\@ACMkeywords}{#1}} 439 | 440 | \newcommand{\keywordlist}{% 441 | \vspace{0.5\baselineskip}% 442 | \par\noindent \textbf{Keywords: } \@ACMkeywords% 443 | } 444 | 445 | %%% Computing Review (CR) categories. 446 | 447 | \newenvironment{CRcatlist}{% 448 | \vspace{0.5\baselineskip}% 449 | \par\noindent \textbf{CR Categories: }% 450 | }{} 451 | 452 | \newcommand{\CRcat}[4]{% 453 | #1 [#2]% 454 | \ifx#3\@ACMempty \else : #3\fi% 455 | \ifx#4\@ACMempty \else ---#4\fi% 456 | } 457 | 458 | %%% Icon(s) with hyperlinks. 459 | 460 | %\newcommand{\@ACMurlWeb}{} 461 | %\newcommand{\TOGprojectURL}[1]{\renewcommand{\@ACMurlWeb}{#1}} 462 | %\newcommand{\@ACMurlVideo}{} 463 | %\newcommand{\TOGvideoURL}[1]{\renewcommand{\@ACMurlVideo}{#1}} 464 | %\newcommand{\@ACMurlData}{} 465 | %\newcommand{\TOGdataURL}[1]{\renewcommand{\@ACMurlData}{#1}} 466 | %\newcommand{\@ACMurlCode}{} 467 | %\newcommand{\TOGcodeURL}[1]{\renewcommand{\@ACMurlCode}{#1}} 468 | 469 | %\newcommand{\icon@DL}{\raisebox{-.02in}{\includegraphics[width=.13in]{icons/iconacm}}\hspace{.01in}DL} 470 | %\newcommand{\icon@PDF}{\raisebox{-.02in}{\includegraphics[width=.11in]{icons/iconpdf}}\hspace{.015in}PDF} 471 | %\newcommand{\icon@Web}{\raisebox{-.025in}{\includegraphics[width=.11in]{icons/iconweb}}\hspace{.01in}Web} 472 | %\newcommand{\icon@Video}{\raisebox{-.01in}{\includegraphics[width=.11in]{icons/iconvideo}}\hspace{.007in}Video} 473 | %\newcommand{\icon@Data}{\raisebox{-.01in}{\includegraphics[width=.10in]{icons/icondata}}\hspace{.015in}Data} 474 | %\newcommand{\icon@Code}{\raisebox{-.005in}{\includegraphics[width=.10in]{icons/iconcode}}\hspace{.017in}Code} 475 | 476 | %\newcommand{\TOGlinkslist}{% 477 | % \if@ACMtog 478 | % {% 479 | % \ifx\@ACMarticleDOI\@ACMempty% 480 | % \ClassWarningNoLine{acmsiggraph}{Please set \noexpand\TOGarticleDOI.}% 481 | % \fi% 482 | % {\bf Links:}% 483 | % \sc% 484 | % \ifx\@ACMarticleDOI\@ACMempty\else% 485 | % \hspace{0.09in}\href{http://doi.acm.org/10.1145/\@ACMarticleDOI}{\icon@DL}% 486 | % \ifx\@ACMarticleDOIsuffix\@ACMempty\else% 487 | % \hspace{0.09in}\href{http://portal.acm.org/ft_gateway.cfm?id=\@ACMarticleDOIsuffix&type=pdf}{\icon@PDF}\fi% 488 | % \ifx\@ACMurlWeb\@ACMempty\else% 489 | % \hspace{0.09in}\href{\@ACMurlWeb}{\icon@Web}\fi% 490 | % \ifx\@ACMurlVideo\@ACMempty\else% 491 | % \hspace{0.09in}\href{\@ACMurlVideo}{\icon@Video}\fi% 492 | % \ifx\@ACMurlData\@ACMempty\else% 493 | % \hspace{0.09in}\href{\@ACMurlData}{\icon@Data}\fi% 494 | % \ifx\@ACMurlCode\@ACMempty\else% 495 | % \hspace{0.09in}\href{\@ACMurlCode}{\icon@Code}\fi% 496 | % \fi% 497 | % }% 498 | % \fi 499 | %} 500 | 501 | % Package hyperref should come late in class file to properly apply to any modified commands. 502 | \RequirePackage{ifpdf} 503 | \ifpdf 504 | \usepackage[pdftex,breaklinks,hyperfootnotes=false,bookmarks=false]{hyperref} 505 | \else 506 | \usepackage[hyperfootnotes=false,bookmarks=false]{hyperref} 507 | \fi 508 | \hypersetup{ 509 | colorlinks=true,linkcolor=black,citecolor=black,urlcolor=black,breaklinks=true 510 | } 511 | 512 | % remove newlines ('\\') from \title when assigning \pdftitle 513 | \pdfstringdefDisableCommands{% 514 | % \let~\textasciitilde 515 | % \def\url{\pdfstringdefWarn\url}% 516 | % \let\textcolor\@gobble 517 | \let\\\@gobble 518 | } 519 | 520 | \AtBeginDocument{% 521 | \if@ACMreview% 522 | \hypersetup{ 523 | pdfcreator={LaTeX acmsiggraph.cls (2014)}, 524 | pdfkeywords={\@ACMkeywords}, 525 | pdftitle={\@title}, 526 | }% 527 | \else% 528 | \hypersetup{ 529 | pdfcreator={LaTeX acmsiggraph.cls (2014)}, 530 | pdfkeywords={\@ACMkeywords}, 531 | pdftitle={\@title}, 532 | pdfauthor={\@ACMpdfauthor}, 533 | }% 534 | \fi 535 | } 536 | 537 | %% end of file 538 | \endinput 539 | -------------------------------------------------------------------------------- /acmsiggraph.bst: -------------------------------------------------------------------------------- 1 | % 'acmsiggraph.bst' 2 | % ACM SIGGRAPH bibliography style (07-Sep-01 version) 3 | % * based on "ACM Transactions bibliography style (24-Jan-88 version)" 4 | % A lot like abbrv.bst, but names come out "Last, initials", and in \sc. 5 | % Some dates are parenthesized. 6 | % * the citation format -- [Jones 2001] -- is pulled from 'alpha.bst' 7 | % 8 | % Version History 9 | % * 07 Sept 2001: original version - Stephen Spencer (spencer@acm.org) 10 | % * 22 Dec 2003: tweaked file for entry w/out year, removed "n. d." 11 | 12 | ENTRY 13 | { address 14 | author 15 | booktitle 16 | chapter 17 | edition 18 | editor 19 | howpublished 20 | institution 21 | journal 22 | key 23 | month 24 | note 25 | number 26 | organization 27 | pages 28 | publisher 29 | school 30 | series 31 | title 32 | type 33 | volume 34 | year 35 | } 36 | {} 37 | { label extra.label sort.label} 38 | 39 | INTEGERS { output.state before.all mid.sentence after.sentence after.block } 40 | 41 | FUNCTION {init.state.consts} 42 | { #0 'before.all := 43 | #1 'mid.sentence := 44 | #2 'after.sentence := 45 | #3 'after.block := 46 | } 47 | 48 | STRINGS { s t } 49 | 50 | FUNCTION {output.nonnull} 51 | { 's := 52 | output.state mid.sentence = 53 | { ", " * write$ } 54 | { output.state after.block = 55 | { add.period$ write$ 56 | newline$ 57 | "\newblock " write$ 58 | } 59 | { output.state before.all = 60 | 'write$ 61 | { add.period$ " " * write$ } 62 | if$ 63 | } 64 | if$ 65 | mid.sentence 'output.state := 66 | } 67 | if$ 68 | s 69 | } 70 | 71 | FUNCTION {output} 72 | { duplicate$ empty$ 73 | 'pop$ 74 | 'output.nonnull 75 | if$ 76 | } 77 | 78 | FUNCTION {output.check} 79 | { 't := 80 | duplicate$ empty$ 81 | { pop$ "empty " t * " in " * cite$ * warning$ } 82 | 'output.nonnull 83 | if$ 84 | } 85 | 86 | FUNCTION {output.bibitem} 87 | { newline$ 88 | "\bibitem[" write$ 89 | label write$ 90 | "]{" write$ 91 | cite$ write$ 92 | "}" write$ 93 | newline$ 94 | "" 95 | before.all 'output.state := 96 | } 97 | 98 | FUNCTION {fin.entry} 99 | { add.period$ 100 | write$ 101 | newline$ 102 | } 103 | 104 | FUNCTION {new.block} 105 | { output.state before.all = 106 | 'skip$ 107 | { after.block 'output.state := } 108 | if$ 109 | } 110 | 111 | FUNCTION {new.sentence} 112 | { output.state after.block = 113 | 'skip$ 114 | { output.state before.all = 115 | 'skip$ 116 | { after.sentence 'output.state := } 117 | if$ 118 | } 119 | if$ 120 | } 121 | 122 | FUNCTION {not} 123 | { { #0 } 124 | { #1 } 125 | if$ 126 | } 127 | 128 | FUNCTION {and} 129 | { 'skip$ 130 | { pop$ #0 } 131 | if$ 132 | } 133 | 134 | FUNCTION {or} 135 | { { pop$ #1 } 136 | 'skip$ 137 | if$ 138 | } 139 | 140 | FUNCTION {new.block.checka} 141 | { empty$ 142 | 'skip$ 143 | 'new.block 144 | if$ 145 | } 146 | 147 | FUNCTION {new.block.checkb} 148 | { empty$ 149 | swap$ empty$ 150 | and 151 | 'skip$ 152 | 'new.block 153 | if$ 154 | } 155 | 156 | FUNCTION {field.or.null} 157 | { duplicate$ empty$ 158 | { pop$ "" } 159 | 'skip$ 160 | if$ 161 | } 162 | 163 | FUNCTION {emphasize} 164 | { duplicate$ empty$ 165 | { pop$ "" } 166 | { "{\em " swap$ * "}" * } 167 | if$ 168 | } 169 | 170 | FUNCTION {emphasizeic} 171 | { duplicate$ empty$ 172 | { pop$ "" } 173 | { "{\em " swap$ * "\/}" * } 174 | if$ 175 | } 176 | 177 | FUNCTION {scapify} 178 | { duplicate$ empty$ 179 | { pop$ "" } 180 | { "{\sc " swap$ * "}" * } 181 | if$ 182 | } 183 | 184 | INTEGERS { nameptr namesleft numnames } 185 | 186 | FUNCTION {format.names} 187 | { 's := 188 | #1 'nameptr := 189 | s num.names$ 'numnames := 190 | numnames 'namesleft := 191 | { namesleft #0 > } 192 | { s nameptr "{vv~}{ll}{, jj}{, f.}" format.name$ 't := 193 | nameptr #1 > 194 | { namesleft #1 > 195 | { ", " * t * } 196 | { t "others" = 197 | { ", et~al." * } 198 | { ", and " * t * } 199 | if$ 200 | } 201 | if$ 202 | } 203 | 't 204 | if$ 205 | nameptr #1 + 'nameptr := 206 | namesleft #1 - 'namesleft := 207 | } 208 | while$ 209 | } 210 | 211 | % For names inside entries (e.g., editors of an "In ..."); 212 | % this is exactly ABBRV.BST's `format.names' function. 213 | FUNCTION {format.innames} 214 | { 's := 215 | #1 'nameptr := 216 | s num.names$ 'numnames := 217 | numnames 'namesleft := 218 | { namesleft #0 > } 219 | { s nameptr "{f.~}{vv~}{ll}{, jj}" format.name$ 't := 220 | nameptr #1 > 221 | { namesleft #1 > 222 | { ", " * t * } 223 | { numnames #2 > 224 | { "," * } 225 | 'skip$ 226 | if$ 227 | t "others" = 228 | { " et~al." * } 229 | { " and " * t * } 230 | if$ 231 | } 232 | if$ 233 | } 234 | 't 235 | if$ 236 | nameptr #1 + 'nameptr := 237 | namesleft #1 - 'namesleft := 238 | } 239 | while$ 240 | } 241 | 242 | FUNCTION {format.authors} 243 | { author empty$ 244 | { "" } 245 | { author format.names scapify } 246 | if$ 247 | } 248 | 249 | FUNCTION {format.editors} 250 | { editor empty$ 251 | { "" } 252 | { editor format.names scapify 253 | editor num.names$ #1 > 254 | { ", Eds." * } 255 | { ", Ed." * } 256 | if$ 257 | } 258 | if$ 259 | } 260 | 261 | FUNCTION {format.publisher.address} 262 | { address empty$ 263 | { publisher empty$ 264 | 'skip$ 265 | { publisher "publisher" output.check 266 | } 267 | if$ 268 | } 269 | { publisher empty$ 270 | 'skip$ 271 | { publisher "publisher" output.check 272 | address "address" output.check 273 | } 274 | if$ 275 | } 276 | if$ 277 | } 278 | 279 | FUNCTION {format.ineditors} 280 | { editor empty$ 281 | { "" } 282 | { editor format.innames 283 | editor num.names$ #1 > 284 | { ", Eds." * } 285 | { ", Ed." * } 286 | if$ 287 | } 288 | if$ 289 | } 290 | 291 | FUNCTION {format.title} 292 | { title empty$ 293 | { "" } 294 | { title "t" change.case$ } 295 | if$ 296 | } 297 | 298 | FUNCTION {n.dashify} 299 | { 't := 300 | "" 301 | { t empty$ not } 302 | { t #1 #1 substring$ "-" = 303 | { t #1 #2 substring$ "--" = not 304 | { "--" * 305 | t #2 global.max$ substring$ 't := 306 | } 307 | { { t #1 #1 substring$ "-" = } 308 | { "-" * 309 | t #2 global.max$ substring$ 't := 310 | } 311 | while$ 312 | } 313 | if$ 314 | } 315 | { t #1 #1 substring$ * 316 | t #2 global.max$ substring$ 't := 317 | } 318 | if$ 319 | } 320 | while$ 321 | } 322 | 323 | FUNCTION {format.year} 324 | { year empty$ 325 | { "" } 326 | { year } 327 | if$ 328 | } 329 | 330 | FUNCTION {format.month} 331 | { month empty$ 332 | { "" } 333 | { month } 334 | if$ 335 | } 336 | 337 | FUNCTION {format.date} 338 | { year empty$ 339 | { month empty$ 340 | { "" } 341 | { "there's a month but no year in " cite$ * warning$ 342 | month 343 | } 344 | if$ 345 | } 346 | { month empty$ 347 | 'year 348 | { month " " * year * } 349 | if$ 350 | } 351 | if$ 352 | } 353 | 354 | FUNCTION {format.btitle} 355 | { title emphasize 356 | } 357 | 358 | FUNCTION {tie.or.space.connect} 359 | { duplicate$ text.length$ #3 < 360 | { "~" } 361 | { " " } 362 | if$ 363 | swap$ * * 364 | } 365 | 366 | FUNCTION {either.or.check} 367 | { empty$ 368 | 'pop$ 369 | { "can't use both " swap$ * " fields in " * cite$ * warning$ } 370 | if$ 371 | } 372 | 373 | FUNCTION {format.bvolume} 374 | { volume empty$ 375 | { "" } 376 | { "vol.~" volume * 377 | series empty$ 378 | 'skip$ 379 | { " of " * series emphasize * } 380 | if$ 381 | "volume and number" number either.or.check 382 | } 383 | if$ 384 | } 385 | 386 | FUNCTION {format.number.series} 387 | { volume empty$ 388 | { number empty$ 389 | { series field.or.null } 390 | { output.state mid.sentence = 391 | { "no.~" } 392 | { "No.~" } 393 | if$ 394 | number * 395 | series empty$ 396 | { "there's a number but no series in " cite$ * warning$ } 397 | { " in " * series * } 398 | if$ 399 | } 400 | if$ 401 | } 402 | { "" } 403 | if$ 404 | } 405 | 406 | FUNCTION {format.edition} 407 | { edition empty$ 408 | { "" } 409 | { output.state mid.sentence = 410 | { edition "l" change.case$ "~ed." * } 411 | { edition "t" change.case$ "~ed." * } 412 | if$ 413 | } 414 | if$ 415 | } 416 | 417 | FUNCTION {format.pages} 418 | { pages empty$ 419 | { "" } 420 | { pages n.dashify } 421 | if$ 422 | } 423 | 424 | INTEGERS { multiresult } 425 | 426 | FUNCTION {multi.page.check} 427 | { 't := 428 | #0 'multiresult := 429 | { multiresult not 430 | t empty$ not 431 | and 432 | } 433 | { t #1 #1 substring$ 434 | duplicate$ "-" = 435 | swap$ duplicate$ "," = 436 | swap$ "+" = 437 | or or 438 | { #1 'multiresult := } 439 | { t #2 global.max$ substring$ 't := } 440 | if$ 441 | } 442 | while$ 443 | multiresult 444 | } 445 | 446 | FUNCTION {format.pp.pages} 447 | { pages empty$ 448 | { "" } 449 | { pages multi.page.check 450 | { "pp.~" pages n.dashify * } 451 | { "p.~" pages * } 452 | if$ 453 | } 454 | if$ 455 | } 456 | 457 | FUNCTION {format.journal.vol.num.date} 458 | { journal empty$ 459 | { "empty journal in " cite$ * warning$ 460 | "" 461 | } 462 | { journal 463 | volume empty$ 464 | 'skip$ 465 | { " " * volume * } 466 | if$ 467 | number empty$ 468 | 'emphasizeic 469 | { emphasize ", " * number * } 470 | if$ 471 | month empty$ 472 | 'skip$ 473 | { " (" * format.month * ")" * } 474 | if$ 475 | } 476 | if$ 477 | } 478 | 479 | FUNCTION {format.chapter.pages} 480 | { chapter empty$ 481 | 'format.pages 482 | { type empty$ 483 | { "ch.~" chapter * } 484 | { type "l" change.case$ chapter tie.or.space.connect } 485 | if$ 486 | pages empty$ 487 | 'skip$ 488 | { ", " * format.pages * } 489 | if$ 490 | } 491 | if$ 492 | } 493 | 494 | FUNCTION {format.in.ed.booktitle} 495 | { booktitle empty$ 496 | { "" } 497 | { "In " booktitle emphasize * 498 | editor empty$ 499 | 'skip$ 500 | { ", " * format.ineditors * } 501 | if$ 502 | } 503 | if$ 504 | } 505 | 506 | FUNCTION {format.in.proc.date} 507 | { booktitle empty$ 508 | { "" } 509 | { "In " booktitle emphasize * } 510 | if$ 511 | } 512 | 513 | FUNCTION {empty.misc.check} 514 | { author empty$ title empty$ howpublished empty$ 515 | month empty$ year empty$ note empty$ 516 | and and and and and 517 | key empty$ not and 518 | { "all relevant fields are empty in " cite$ * warning$ } 519 | 'skip$ 520 | if$ 521 | } 522 | 523 | FUNCTION {format.thesis.type} 524 | { type empty$ 525 | 'skip$ 526 | { pop$ 527 | type "t" change.case$ 528 | } 529 | if$ 530 | } 531 | 532 | FUNCTION {format.tr.number} 533 | { type empty$ 534 | { "Tech. Rep." } 535 | 'type 536 | if$ 537 | number empty$ 538 | { "t" change.case$ } 539 | { number tie.or.space.connect } 540 | if$ 541 | } 542 | 543 | FUNCTION {format.article.crossref} 544 | { key empty$ 545 | { journal empty$ 546 | { "need key or journal for " cite$ * " to crossref " * crossref * 547 | warning$ 548 | "" 549 | } 550 | { "In {\em " journal * "\/}" * } 551 | if$ 552 | } 553 | { "In " key * } 554 | if$ 555 | " \cite{" * crossref * "}" * 556 | } 557 | 558 | FUNCTION {format.crossref.editor} 559 | { editor #1 "{vv~}{ll}" format.name$ 560 | editor num.names$ duplicate$ 561 | #2 > 562 | { pop$ " et~al." * } 563 | { #2 < 564 | 'skip$ 565 | { editor #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" = 566 | { " et~al." * } 567 | { " and " * editor #2 "{vv~}{ll}" format.name$ * } 568 | if$ 569 | } 570 | if$ 571 | } 572 | if$ 573 | } 574 | 575 | FUNCTION {format.book.crossref} 576 | { volume empty$ 577 | { "empty volume in " cite$ * "'s crossref of " * crossref * warning$ 578 | "In " 579 | } 580 | { "Vol.~" volume * 581 | " of " * 582 | } 583 | if$ 584 | editor empty$ 585 | editor field.or.null author field.or.null = 586 | or 587 | { key empty$ 588 | { series empty$ 589 | { "need editor, key, or series for " cite$ * " to crossref " * 590 | crossref * warning$ 591 | "" * 592 | } 593 | { "{\em " * series * "\/}" * } 594 | if$ 595 | } 596 | { key * } 597 | if$ 598 | } 599 | { format.crossref.editor * } 600 | if$ 601 | " \cite{" * crossref * "}" * 602 | } 603 | 604 | FUNCTION {format.incoll.inproc.crossref} 605 | { editor empty$ 606 | editor field.or.null author field.or.null = 607 | or 608 | { key empty$ 609 | { booktitle empty$ 610 | { "need editor, key, or booktitle for " cite$ * " to crossref " * 611 | crossref * warning$ 612 | "" 613 | } 614 | { "In {\em " booktitle * "\/}" * } 615 | if$ 616 | } 617 | { "In " key * } 618 | if$ 619 | } 620 | { "In " format.crossref.editor * } 621 | if$ 622 | " \cite{" * crossref * "}" * 623 | } 624 | 625 | FUNCTION {article} 626 | { output.bibitem 627 | format.authors "author" output.check 628 | new.block 629 | format.year output 630 | new.block 631 | format.title "title" output.check 632 | new.block 633 | crossref missing$ 634 | { format.journal.vol.num.date output 635 | format.pages output 636 | } 637 | { format.article.crossref output.nonnull 638 | format.pages output 639 | } 640 | if$ 641 | new.block 642 | note output 643 | fin.entry 644 | } 645 | 646 | FUNCTION {book} 647 | { output.bibitem 648 | author empty$ 649 | { format.editors "author and editor" output.check } 650 | { format.authors output.nonnull 651 | crossref missing$ 652 | { "author and editor" editor either.or.check } 653 | 'skip$ 654 | if$ 655 | } 656 | if$ 657 | new.block 658 | format.year "year" output.check 659 | new.block 660 | format.btitle "title" output.check 661 | format.edition output 662 | crossref missing$ 663 | { format.bvolume output 664 | new.block 665 | format.number.series output 666 | new.sentence 667 | publisher "publisher" output.check 668 | address output 669 | } 670 | { new.block 671 | format.book.crossref output.nonnull 672 | } 673 | if$ 674 | format.month output 675 | new.block 676 | note output 677 | fin.entry 678 | } 679 | 680 | FUNCTION {booklet} 681 | { output.bibitem 682 | format.authors output 683 | new.block 684 | format.year output 685 | new.block 686 | format.title "title" output.check 687 | howpublished address new.block.checkb 688 | howpublished output 689 | address output 690 | format.month output 691 | new.block 692 | note output 693 | fin.entry 694 | } 695 | 696 | FUNCTION {inbook} 697 | { output.bibitem 698 | author empty$ 699 | { format.editors "author and editor" output.check } 700 | { format.authors output.nonnull 701 | crossref missing$ 702 | { "author and editor" editor either.or.check } 703 | 'skip$ 704 | if$ 705 | } 706 | if$ 707 | new.block 708 | format.year "year" output.check 709 | new.block 710 | format.btitle "title" output.check 711 | format.edition output 712 | crossref missing$ 713 | { format.bvolume output 714 | new.block 715 | format.number.series output 716 | new.sentence 717 | publisher "publisher" output.check 718 | address output 719 | } 720 | { new.block 721 | format.book.crossref output.nonnull 722 | } 723 | if$ 724 | format.month output 725 | format.chapter.pages "chapter and pages" output.check 726 | new.block 727 | note output 728 | fin.entry 729 | } 730 | 731 | FUNCTION {incollection} 732 | { output.bibitem 733 | format.authors "author" output.check 734 | new.block 735 | format.year "year" output.check 736 | new.block 737 | format.title "title" output.check 738 | new.block 739 | crossref missing$ 740 | { format.in.ed.booktitle "booktitle" output.check 741 | format.edition output 742 | format.bvolume output 743 | format.number.series output 744 | new.sentence 745 | publisher "publisher" output.check 746 | address output 747 | format.month output 748 | } 749 | { format.incoll.inproc.crossref output.nonnull } 750 | if$ 751 | format.chapter.pages output 752 | new.block 753 | note output 754 | fin.entry 755 | } 756 | 757 | FUNCTION {inproceedings} 758 | { output.bibitem 759 | format.authors "author" output.check 760 | new.block 761 | format.year "year" output.check 762 | new.block 763 | format.title "title" output.check 764 | new.block 765 | crossref missing$ 766 | { format.in.proc.date "booktitle" output.check 767 | address empty$ 768 | { publisher empty$ 769 | 'skip$ 770 | { publisher "publisher" output.check 771 | } 772 | if$ 773 | } 774 | { publisher empty$ 775 | 'skip$ 776 | { publisher "publisher" output.check 777 | address "address" output.check 778 | } 779 | if$ 780 | } 781 | if$ 782 | format.ineditors output 783 | format.bvolume output 784 | format.number.series output 785 | organization "organization" output.check 786 | } 787 | { format.incoll.inproc.crossref output.nonnull } 788 | if$ 789 | format.pages output 790 | new.block 791 | note output 792 | fin.entry 793 | } 794 | 795 | FUNCTION {conference} { inproceedings } 796 | 797 | FUNCTION {manual} 798 | { output.bibitem 799 | author empty$ 800 | { organization scapify output } 801 | { format.authors output.nonnull } 802 | if$ 803 | new.block 804 | format.year output 805 | new.block 806 | format.btitle "title" output.check 807 | format.edition output 808 | author empty$ 809 | { address new.block.checka } 810 | { organization address new.block.checkb 811 | organization output 812 | } 813 | if$ 814 | address output 815 | format.month output 816 | new.block 817 | note output 818 | fin.entry 819 | } 820 | 821 | FUNCTION {mastersthesis} 822 | { output.bibitem 823 | format.authors "author" output.check 824 | new.block 825 | format.year "year" output.check 826 | new.block 827 | format.btitle "title" output.check 828 | new.block 829 | "Master's thesis" format.thesis.type output.nonnull 830 | school "school" output.check 831 | address output 832 | new.block 833 | note output 834 | fin.entry 835 | } 836 | 837 | FUNCTION {misc} 838 | { output.bibitem 839 | format.authors output 840 | format.year output 841 | title howpublished new.block.checkb 842 | format.title output 843 | howpublished new.block.checka 844 | howpublished output 845 | format.month output 846 | new.block 847 | note output 848 | fin.entry 849 | empty.misc.check 850 | } 851 | 852 | FUNCTION {phdthesis} 853 | { output.bibitem 854 | format.authors "author" output.check 855 | new.block 856 | format.year "year" output.check 857 | new.block 858 | format.btitle "title" output.check 859 | new.block 860 | "PhD thesis" format.thesis.type output.nonnull 861 | school "school" output.check 862 | address output 863 | new.block 864 | note output 865 | fin.entry 866 | } 867 | 868 | FUNCTION {proceedings} 869 | { output.bibitem 870 | editor empty$ 871 | { organization scapify output } 872 | { format.editors output.nonnull } 873 | if$ 874 | new.block 875 | format.year output 876 | new.block 877 | title "title" output.check 878 | format.bvolume output 879 | format.number.series output 880 | editor empty$ 881 | 'skip$ 882 | { organization output } 883 | if$ 884 | address empty$ 885 | { publisher empty$ 886 | 'skip$ 887 | { publisher "publisher" output.check 888 | } 889 | if$ 890 | } 891 | { publisher empty$ 892 | 'skip$ 893 | { publisher "publisher" output.check 894 | address "address" output.check 895 | } 896 | if$ 897 | } 898 | if$ 899 | new.block 900 | note output 901 | fin.entry 902 | } 903 | 904 | FUNCTION {techreport} 905 | { output.bibitem 906 | format.authors "author" output.check 907 | new.block 908 | format.year "year" output.check 909 | new.block 910 | format.title "title" output.check 911 | new.block 912 | format.tr.number output.nonnull 913 | institution "institution" output.check 914 | address output 915 | format.month output 916 | new.block 917 | note output 918 | fin.entry 919 | } 920 | 921 | FUNCTION {unpublished} 922 | { output.bibitem 923 | format.authors "author" output.check 924 | new.block 925 | format.year output 926 | new.block 927 | format.title "title" output.check 928 | new.block 929 | note "note" output.check 930 | format.month output 931 | fin.entry 932 | } 933 | 934 | FUNCTION {default.type} { misc } 935 | 936 | MACRO {jan} {"Jan."} 937 | 938 | MACRO {feb} {"Feb."} 939 | 940 | MACRO {mar} {"Mar."} 941 | 942 | MACRO {apr} {"Apr."} 943 | 944 | MACRO {may} {"May"} 945 | 946 | MACRO {jun} {"June"} 947 | 948 | MACRO {jul} {"July"} 949 | 950 | MACRO {aug} {"Aug."} 951 | 952 | MACRO {sep} {"Sept."} 953 | 954 | MACRO {oct} {"Oct."} 955 | 956 | MACRO {nov} {"Nov."} 957 | 958 | MACRO {dec} {"Dec."} 959 | 960 | MACRO {acmcs} {"ACM Comput. Surv."} 961 | 962 | MACRO {acta} {"Acta Inf."} 963 | 964 | MACRO {cacm} {"Commun. ACM"} 965 | 966 | MACRO {ibmjrd} {"IBM J. Res. Dev."} 967 | 968 | MACRO {ibmsj} {"IBM Syst.~J."} 969 | 970 | MACRO {ieeese} {"IEEE Trans. Softw. Eng."} 971 | 972 | MACRO {ieeetc} {"IEEE Trans. Comput."} 973 | 974 | MACRO {ieeetcad} 975 | {"IEEE Trans. Comput.-Aided Design Integrated Circuits"} 976 | 977 | MACRO {ipl} {"Inf. Process. Lett."} 978 | 979 | MACRO {jacm} {"J.~ACM"} 980 | 981 | MACRO {jcss} {"J.~Comput. Syst. Sci."} 982 | 983 | MACRO {scp} {"Sci. Comput. Programming"} 984 | 985 | MACRO {sicomp} {"SIAM J. Comput."} 986 | 987 | MACRO {tocs} {"ACM Trans. Comput. Syst."} 988 | 989 | MACRO {tods} {"ACM Trans. Database Syst."} 990 | 991 | MACRO {tog} {"ACM Trans. Gr."} 992 | 993 | MACRO {toms} {"ACM Trans. Math. Softw."} 994 | 995 | MACRO {toois} {"ACM Trans. Office Inf. Syst."} 996 | 997 | MACRO {toplas} {"ACM Trans. Program. Lang. Syst."} 998 | 999 | MACRO {tcs} {"Theoretical Comput. Sci."} 1000 | 1001 | READ 1002 | 1003 | FUNCTION {sortify} 1004 | { purify$ 1005 | "l" change.case$ 1006 | } 1007 | 1008 | INTEGERS { len } 1009 | 1010 | FUNCTION {chop.word} 1011 | { 's := 1012 | 'len := 1013 | s #1 len substring$ = 1014 | { s len #1 + global.max$ substring$ } 1015 | 's 1016 | if$ 1017 | } 1018 | 1019 | INTEGERS { et.al.char.used } 1020 | 1021 | FUNCTION {initialize.et.al.char.used} 1022 | { #0 'et.al.char.used := 1023 | } 1024 | 1025 | EXECUTE {initialize.et.al.char.used} 1026 | 1027 | FUNCTION {format.lab.names} 1028 | { 1029 | 's := 1030 | s num.names$ 'numnames := 1031 | numnames #2 > % change number to number of others allowed before 1032 | % forcing "et al". 1033 | { s #1 "{vv~}{ll}" format.name$ " et~al\mbox{.}" * } 1034 | { 1035 | numnames #1 - 'namesleft := 1036 | #2 'nameptr := 1037 | s #1 "{vv~}{ll}" format.name$ 1038 | { namesleft #0 > } 1039 | { nameptr numnames = 1040 | { s nameptr "{ff }{vv }{ll}{ jj}" format.name$ "others" = 1041 | { " et~al\mbox{.}" * } 1042 | { " and " * s nameptr "{vv~}{ll}" format.name$ * } 1043 | if$ 1044 | } 1045 | { ", " * s nameptr "{vv~}{ll}" format.name$ * } 1046 | if$ 1047 | nameptr #1 + 'nameptr := 1048 | namesleft #1 - 'namesleft := 1049 | } 1050 | while$ 1051 | } 1052 | if$ 1053 | } 1054 | 1055 | 1056 | FUNCTION {author.key.label} 1057 | { author empty$ 1058 | { key empty$ 1059 | { cite$ #1 #3 substring$ } 1060 | { key #3 text.prefix$ } 1061 | if$ 1062 | } 1063 | { author format.lab.names } 1064 | if$ 1065 | } 1066 | 1067 | FUNCTION {author.editor.key.label} 1068 | { author empty$ 1069 | { editor empty$ 1070 | { key empty$ 1071 | { cite$ #1 #3 substring$ } 1072 | { key #3 text.prefix$ } 1073 | if$ 1074 | } 1075 | { editor format.lab.names } 1076 | if$ 1077 | } 1078 | { author format.lab.names } 1079 | if$ 1080 | } 1081 | 1082 | FUNCTION {author.key.organization.label} 1083 | { author empty$ 1084 | { key empty$ 1085 | { organization empty$ 1086 | { cite$ #1 #3 substring$ } 1087 | { "The " #4 organization chop.word #3 text.prefix$ } 1088 | if$ 1089 | } 1090 | { key #3 text.prefix$ } 1091 | if$ 1092 | } 1093 | { author format.lab.names } 1094 | if$ 1095 | } 1096 | 1097 | FUNCTION {editor.key.organization.label} 1098 | { editor empty$ 1099 | { key empty$ 1100 | { organization empty$ 1101 | { cite$ #1 #3 substring$ } 1102 | { "The " #4 organization chop.word #3 text.prefix$ } 1103 | if$ 1104 | } 1105 | { key #3 text.prefix$ } 1106 | if$ 1107 | } 1108 | { editor format.lab.names } 1109 | if$ 1110 | } 1111 | 1112 | FUNCTION {calc.label} 1113 | { type$ "book" = 1114 | type$ "inbook" = 1115 | or 1116 | 'author.editor.key.label 1117 | { type$ "proceedings" = 1118 | 'editor.key.organization.label 1119 | { type$ "manual" = 1120 | 'author.key.organization.label 1121 | 'author.key.label 1122 | if$ 1123 | } 1124 | if$ 1125 | } 1126 | if$ 1127 | 1128 | duplicate$ 1129 | year empty$ 1130 | { 1131 | "\protect\citename{" swap$ * " }" * 1132 | "" * 'label := 1133 | } 1134 | { 1135 | "\protect\citename{" swap$ * " }" * 1136 | year 1137 | * 1138 | 'label := 1139 | } 1140 | if$ 1141 | 1142 | year field.or.null * 1143 | sortify 'sort.label := 1144 | } 1145 | 1146 | FUNCTION {sort.format.names} 1147 | { 's := 1148 | #1 'nameptr := 1149 | "" 1150 | s num.names$ 'numnames := 1151 | numnames 'namesleft := 1152 | { namesleft #0 > } 1153 | { nameptr #1 > 1154 | { " " * } 1155 | 'skip$ 1156 | if$ 1157 | s nameptr "{vv{ } }{ll{ }}{ ff{ }}{ jj{ }}" format.name$ 't := 1158 | nameptr numnames = t "others" = and 1159 | { "et al" * } 1160 | { t sortify * } 1161 | if$ 1162 | nameptr #1 + 'nameptr := 1163 | namesleft #1 - 'namesleft := 1164 | } 1165 | while$ 1166 | } 1167 | 1168 | FUNCTION {sort.format.title} 1169 | { 't := 1170 | "A " #2 1171 | "An " #3 1172 | "The " #4 t chop.word 1173 | chop.word 1174 | chop.word 1175 | sortify 1176 | #1 global.max$ substring$ 1177 | } 1178 | 1179 | FUNCTION {author.sort} 1180 | { author empty$ 1181 | { key empty$ 1182 | { "to sort, need author or key in " cite$ * warning$ 1183 | "" 1184 | } 1185 | { key sortify } 1186 | if$ 1187 | } 1188 | { author sort.format.names } 1189 | if$ 1190 | } 1191 | 1192 | FUNCTION {author.editor.sort} 1193 | { author empty$ 1194 | { editor empty$ 1195 | { key empty$ 1196 | { "to sort, need author, editor, or key in " cite$ * warning$ 1197 | "" 1198 | } 1199 | { key sortify } 1200 | if$ 1201 | } 1202 | { editor sort.format.names } 1203 | if$ 1204 | } 1205 | { author sort.format.names } 1206 | if$ 1207 | } 1208 | 1209 | FUNCTION {author.organization.sort} 1210 | { author empty$ 1211 | { organization empty$ 1212 | { key empty$ 1213 | { "to sort, need author, organization, or key in " cite$ * warning$ 1214 | "" 1215 | } 1216 | { key sortify } 1217 | if$ 1218 | } 1219 | { "The " #4 organization chop.word sortify } 1220 | if$ 1221 | } 1222 | { author sort.format.names } 1223 | if$ 1224 | } 1225 | 1226 | FUNCTION {editor.organization.sort} 1227 | { editor empty$ 1228 | { organization empty$ 1229 | { key empty$ 1230 | { "to sort, need editor, organization, or key in " cite$ * warning$ 1231 | "" 1232 | } 1233 | { key sortify } 1234 | if$ 1235 | } 1236 | { "The " #4 organization chop.word sortify } 1237 | if$ 1238 | } 1239 | { editor sort.format.names } 1240 | if$ 1241 | } 1242 | 1243 | FUNCTION {presort} 1244 | { calc.label 1245 | sort.label 1246 | " " 1247 | * 1248 | type$ "book" = 1249 | type$ "inbook" = 1250 | or 1251 | 'author.editor.sort 1252 | { type$ "proceedings" = 1253 | 'editor.organization.sort 1254 | { type$ "manual" = 1255 | 'author.organization.sort 1256 | 'author.sort 1257 | if$ 1258 | } 1259 | if$ 1260 | } 1261 | if$ 1262 | * 1263 | " " 1264 | * 1265 | year field.or.null sortify 1266 | * 1267 | " " 1268 | * 1269 | title field.or.null 1270 | sort.format.title 1271 | * 1272 | #1 entry.max$ substring$ 1273 | 'sort.key$ := 1274 | } 1275 | 1276 | ITERATE {presort} 1277 | 1278 | SORT 1279 | 1280 | STRINGS { longest.label last.sort.label next.extra } 1281 | 1282 | INTEGERS { longest.label.width last.extra.num } 1283 | 1284 | FUNCTION {initialize.longest.label} 1285 | { "" 'longest.label := 1286 | #0 int.to.chr$ 'last.sort.label := 1287 | "" 'next.extra := 1288 | #0 'longest.label.width := 1289 | #0 'last.extra.num := 1290 | } 1291 | 1292 | FUNCTION {forward.pass} 1293 | { last.sort.label sort.label = 1294 | { last.extra.num #1 + 'last.extra.num := 1295 | last.extra.num int.to.chr$ 'extra.label := 1296 | } 1297 | { "a" chr.to.int$ 'last.extra.num := 1298 | "" 'extra.label := 1299 | sort.label 'last.sort.label := 1300 | } 1301 | if$ 1302 | } 1303 | 1304 | FUNCTION {reverse.pass} 1305 | { next.extra "b" = 1306 | { "a" 'extra.label := } 1307 | 'skip$ 1308 | if$ 1309 | label extra.label * 'label := 1310 | label width$ longest.label.width > 1311 | { label 'longest.label := 1312 | label width$ 'longest.label.width := 1313 | } 1314 | 'skip$ 1315 | if$ 1316 | extra.label 'next.extra := 1317 | } 1318 | 1319 | EXECUTE {initialize.longest.label} 1320 | 1321 | ITERATE {forward.pass} 1322 | 1323 | REVERSE {reverse.pass} 1324 | 1325 | FUNCTION {begin.bib} 1326 | { et.al.char.used 1327 | { "\newcommand{\etalchar}[1]{$^{#1}$}" write$ newline$ } 1328 | 'skip$ 1329 | if$ 1330 | preamble$ empty$ 1331 | 'skip$ 1332 | { preamble$ write$ newline$ } 1333 | if$ 1334 | "\begin{thebibliography}{" longest.label * "}" * write$ newline$ 1335 | } 1336 | 1337 | EXECUTE {begin.bib} 1338 | 1339 | EXECUTE {init.state.consts} 1340 | 1341 | ITERATE {call.type$} 1342 | 1343 | FUNCTION {end.bib} 1344 | { newline$ 1345 | "\end{thebibliography}" write$ newline$ 1346 | } 1347 | 1348 | EXECUTE {end.bib} 1349 | 1350 | --------------------------------------------------------------------------------