joel-coffman / latex-incubator

LaTeX packages that don't have a stable API yet
0 stars 0 forks source link

Use standard list environment for publications #9

Open joel-coffman opened 3 years ago

joel-coffman commented 3 years ago

Rather than defining a custom list environment (which matches a traditional bibliography), the resume package could simply use enumerate in conjunction with the enumitem package to format labels. Such an implementation would be much clearer and easier to maintain.

joel-coffman commented 3 years ago

Proof-of-concept implementation:

diff --git a/texmf/tex/latex/resume/resume.sty b/texmf/tex/latex/resume/resume.sty
index 01b9520..db11bbc 100644
--- a/texmf/tex/latex/resume/resume.sty
+++ b/texmf/tex/latex/resume/resume.sty
@@ -133,8 +133,6 @@
     \hfill joel-coffman/joel-coffman.github.io#2%
   }%
 }
-\newcounter{c@reference}
-\newcounter{c@publication}
 \newenvironment{publications}[1]{%
   \newcommand{\publication}[2][]{%
     \bibitem{##2} \bibentry{##2}
@@ -145,16 +143,13 @@
   }%
   \subsection{#1}%
   \raggedright%
-  \begin{list}{%
-      \@biblabel{\arabic{c@publication}}%
-  }{%
-      \usecounter{c@publication}
-      \setcounter{c@publication}{\value{c@reference}}%
-      \setlength{\topsep}{0ex}%
-  }%
+  \begin{enumerate}[
+    label={[\arabic*]},
+    ref=\arabic*,
+    resume=publications,
+  ]
 }{%
-  \setcounter{c@reference}{\value{c@publication}}%
-  \end{list}%
+  \end{enumerate}
 }
 \endinput
 %%
joel-coffman commented 3 years ago

The downside (or advantage, depending on how one looks at it) of using the enumerate environment is that any options specified globally using the enumitem package also apply to the list of publications.