Skip to content

Commit

Permalink
Change biblatex style to address #263
Browse files Browse the repository at this point in the history
  • Loading branch information
kmccurley committed Jun 18, 2024
1 parent 044283d commit b045ca9
Show file tree
Hide file tree
Showing 8 changed files with 239 additions and 8 deletions.
21 changes: 15 additions & 6 deletions iacrcc/iacrcc.cls
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
\def\fileversion{0.68}
\def\filedate{2024/06/12}
\def\fileversion{0.69}
\def\filedate{2024/06/17}

\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\typeout{^^J *** LaTeX class for IACR Communications in Cryptology v\fileversion\space ***^^J}
Expand Down Expand Up @@ -992,11 +992,20 @@
% csquotes: context sensitive quotation facilities
\RequirePackage{csquotes} % to fix a conflict with biblatex and doclicense.
% biblatex: sophisticated Bibliographies in LaTeX
\RequirePackage[backend=biber,style=alphabetic,maxcitenames=4,maxbibnames=20,useprefix=true]{biblatex}[2019/12/01]
\RequirePackage[backend=biber,style=trad-alpha,minalphanames=3,maxalphanames=4,maxbibnames=20,useprefix=true]{biblatex}[2019/12/01]
\DeclarePrintbibliographyDefaults{heading=bibintoc}%
\DeclareNameFormat{author}{%
\usebibmacro{name:given-family}{\namepartfamily}{\namepartgiven}{\namepartprefix}{\namepartsuffix}%
}%
\DeclareLabelalphaTemplate{
\labelelement{
\field[strwidth=3,strside=left]{label}
\field[strwidth=3,strside=left,ifnames=1]{labelname}
\field[strwidth=1,strside=left]{labelname}
\field[strwidth=3,strside=left]{citekey}
}
\labelelement{\field[strwidth=2,strside=right]{year}}
}
%% \DeclareNameFormat{author}{%
%% \usebibmacro{name:given-family}{\namepartfamily}{\namepartgiven}{\namepartprefix}{\namepartsuffix}%
%% }%
\else % did not invoke \documentclass[biblatex]{iacrcc}
\AtBeginDocument{%
\@ifpackageloaded{biblatex}{%
Expand Down
Binary file modified iacrcc/iacrdoc.pdf
Binary file not shown.
4 changes: 2 additions & 2 deletions iacrcc/iacrdoc.tex
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
\def\BibLaTeX{Bib\LaTeX}

\title[running = {The iacrcc class},
subtitle = {iacrcc LaTeX Class Documentation (v0.68)}
subtitle = {iacrcc LaTeX Class Documentation (v0.69)}
]{How to Use the IACR Communications in Cryptology Class}

\genericfootnote{This is a generic footnote produced with \cmd[...]{genericfootnote}.}
Expand Down Expand Up @@ -484,7 +484,7 @@ \section{Typesetting the Bibliography}
standard~\cite{AES-FIPS}, and \cite{DBLP:conf/crypto/Kocher96}.

For the IACR Communications in Cryptology, you will be required to
upload your \BibTeX files rather than just the \texttt{bbl} file.
upload your \BibTeX\ files rather than just the \texttt{bbl} file.
Many authors use the \texttt{cryptobib} \BibTeX\ files, and you need
not upload those with your paper. They can be referenced as
\texttt{\textbackslash bibliography\{cryptobib/abbrev1,cryptobib/crypto\}}
Expand Down
52 changes: 52 additions & 0 deletions iacrcc/tests/compile_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1310,3 +1310,55 @@ def test35_test():
with tempfile.TemporaryDirectory() as tmpdirpath:
res = run_engine(option, path.iterdir(), tmpdirpath)
assert res['proc'].returncode != 0

def test36_test():
path = Path('test36')
labels = [('algorand', 'alg'),
('website', 'DFi20'),
('DHMR08', 'DHMR08'),
('ong', 'EAK{$^{+'),
('art2', 'Gro20'),
('art1', 'GT20'),
('EPRINT:KleOneAki23', 'K{\\"O'),
('hand', 'MvOV01'),
('sealcrypto', 'SEA20'),
('turing', 'Tur53')]
with tempfile.TemporaryDirectory() as tmpdirpath:
bibtex_trigger = tmpdirpath / Path('usebibtex')
bibtex_trigger.touch()
files = [path / Path('main.tex'), path / Path('main.bib'), path / Path('iacrcc.cls')]
res = run_engine('-pdf', files, tmpdirpath)
assert res['proc'].returncode == 0
auxpath = tmpdirpath / Path('main.aux')
auxlines = [line for line in auxpath.read_text().splitlines() if '\\bibcite' in line]
bibtex_keys = []
for line in auxlines:
m = re.search(r'\\bibcite\{([^}]+)\}\{([^}]*)\}', line)
bibtex_keys.append((m.group(1), m.group(2)))
for i in range(len(labels)):
assert bibtex_keys[i][0] == labels[i][0]
assert bibtex_keys[i][1] == labels[i][1]
assert len(auxlines) == 10
# now run with biblatex. We extract the references from main.bbl,
# which has a different format than with bibtex.
BIBLATEX_PATT = r'\\entry{([^}]+)}(?:.*\\field{labelalpha}{([^}]+)})?(?:.*\\field{extraalpha}{([^}]+)})?'
# biblatex produces a slightly different label here that is visually identical
labels[3] = ('ong', 'EAK\\textsuperscript {+')
labels[6] = ('EPRINT:KleOneAki23', 'KÖA23')
with tempfile.TemporaryDirectory() as tmpdirpath:
files = [path / Path('main.tex'), path / Path('main.bib'), path / Path('iacrcc.cls')]
res = run_engine('-pdf', files, tmpdirpath)
assert res['proc'].returncode == 0
bbl_path = tmpdirpath / Path('main.bbl')
bbl_str = ' '.join(bbl_path.read_text().splitlines())
entryparts = re.split(r'\\endentry', bbl_str)
bibtex_keys = []
for part in entryparts:
m = re.search(BIBLATEX_PATT, part)
if m:
bibtex_keys.append((m.group(1), m.group(2)))
for i in range(len(labels)):
assert bibtex_keys[i][0] == labels[i][0]
assert bibtex_keys[i][1] == labels[i][1]
assert len(bibtex_keys) == 10

18 changes: 18 additions & 0 deletions iacrcc/tests/test36/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

TEXFILES=main.tex main.bib

bibtex: $(TEXFILES)
touch usebibtex
latexmk -pdf main
mv main.pdf bibtex.pdf

biblatex: $(TEXFILES)
rm -f usebibtex
latexmk -pdf main
mv main.pdf biblatex.pdf

zipfile: $(TEXFILES)
zip main.zip main.tex main.bib

clean:
rm -f main.pdf main.blg main.aux main.log main.bbl main.out main.meta main.run.xml main.bcf main.abstract main.fdb_latexmk main.fls main.dvi usebibtex main.zip
1 change: 1 addition & 0 deletions iacrcc/tests/test36/iacrcc.cls
105 changes: 105 additions & 0 deletions iacrcc/tests/test36/main.bib
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
@InProceedings{ong,
author={Estes, Dennis
and Adleman, Leonard M.
and Kompella, Kireeti
and McCurley, Kevin S.
and Miller, Gary L.},
editor={Williams, Hugh C.},
title={Breaking the {Ong}-{Schnorr}-{Shamir} Signature Scheme for Quadratic Number Fields},
booktitle={Advances in Cryptology --- CRYPTO '85 Proceedings},
year={1986},
publisher={Springer Berlin Heidelberg},
address={Berlin, Heidelberg},
pages={3--13},
abstract={Recently Ong, Schnorr, and Shamir [OSS1, OSS2] have presented new public key signature schemes based on quadratic equations. We will refer to these as the OSS schemes. The security of the schemes rest in part on the difficulty of finding solutions to (1){\$}{\$}X^2 - KY^2 {\backslash}equiv M(mod{\{}{\backslash}mathbf{\{} {\}}{\}}n),{\$}{\$}where n is the product of two large rational primes. In the original OSS scheme [OSS1], K, M, X, and Y were to be rational integers. However, when this version succumbed to an attack by Pollard [PS,S1], a new version was introduced [OSS2], where M, X, and Y were to be quadratic integers, i. e. elements of the ring {\$}{\$}Z[{\backslash}sqrt d ]{\$}{\$}. In this paper we will show that the OSS system in {\$}{\$}Z[{\backslash}sqrt d ]{\$}{\$}is also breakable The method by which we do this is to reduce the problem of solving the congruence over the ring {\$}{\$}Z[{\backslash}sqrt d ]{\$}{\$}to the problem of solving the congruence over the integers, for which we can use Pollard's algorithm.},
isbn={978-3-540-39799-1},
DOI={10.1007/3-540-39799-X_1}
}


@article{turing,
title = {Some calculations of the {Riemann} zeta-function},
author = {Alan M. Turing},
journal={Proc. London Math. Soc.},
volume = {s3-3},
number=2,
pages={180--97},
year={1953},
DOI={10.1112/plms/s3-3.1.99}
}

@article{DHMR08,
title = {\textit{Ad-Hoc} Threshold Broadcast Encryption with Shorter Ciphertexts},
author = {Vanesa Daza
and Javier Herranz
and Paz Morillo
and Carla R{\`a}fols},
journal = {Electronic Notes in Theoretical Computer Science},
volume = {192},
number = {2},
pages = {3--15},
year = {2008},
note = {Proceedings of the Third Workshop on Cryptography for Ad-hoc Networks (WCAN 2007)},
issn = {1571-0661},
doi = {10.1016/j.entcs.2008.05.002},
}

@misc{website,
title={{DF}inity website},
note={Viewed on April 15, 2020. This has a non-integer year, a key, and a label.},
year={Around 2020},
url={https://dfinity.com/},
key={DFi},
label={DFi},
}

@misc{algorand,
title={Algorand website},
note={Viewed on April 20, 2020. This has no year and nothing to help dictate the label. The label is simply a truncation of the citekey.},
url={https://algorand.com/},
}

@misc{sealcrypto,
title = {{M}icrosoft {SEAL} (release 3.6)},
howpublished = {\url{https://github.com/Microsoft/SEAL}},
month = nov,
year = 2020,
note = {Microsoft Research, Redmond, WA.},
key = {SEAL},
label = {SEAL}
}

@article{art1,
author={Peter Graham and Alan Turing},
title={Two authors out or order},
journal={Journal of Annoying BibTeX},
year=2020,
pages={1-1000}
}

@article{art2,
author={Peter Gross},
title={Just {Peter} as an author},
journal={Journal of Annoying BibTeX},
year=2020,
pages={1-1000}
}

@Misc{EPRINT:KleOneAki23,
author = "Jakub Klemsa and
Melek {\"O}nen and
Yavuz Ak{\i}n",
title = "A Practical {TFHE}-Based Multi-Key Homomorphic Encryption with Linear Complexity and Low Noise Growth",
year = 2023,
howpublished = "Cryptology ePrint Archive, Report 2023/065",
note = "\url{https://eprint.iacr.org/2023/065}",
}

@book{hand,
author = {Alfred J. Menezes and Paul C. van Oorschot and Scott A. Vanstone},
title = {Handbook of Applied Cryptography},
isbn = {0-8493-8523-7},
year = {2001},
pages = {816},
publisher = {CRC Press}
}
46 changes: 46 additions & 0 deletions iacrcc/tests/test36/main.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
%\documentclass{iacrcc}
\newif\ifusebibtex\usebibtexfalse
\IfFileExists{usebibtex}{% biblatex
\usebibtextrue
\typeout{^^JUsing bibtex^^J}
\documentclass[version=final]{iacrcc}
\title{This uses bibtex}
}{% biblatex
\typeout{^^JUsing biblatex^^J}
\documentclass[version=final,biblatex]{iacrcc}
% \DeclareLabelalphaTemplate{
% \labelelement{\field[strwidth=1, strside=left, uppercase, names=3]{labelname}}
% \labelelement{\field[strwidth=2, strside=right]{year}}
% }
\title{This uses biblatex}
\addbibresource{main.bib}
}
\license{CC-by}
\addauthor[inst={1},email={[email protected]}]{Fester Bestertester}
\addaffiliation[country={Elbonia}]{Institute of Annoying BibTeX}
\begin{document}
\maketitle
\begin{abstract}
This is an abstract
\end{abstract}
\begin{textabstract}
This is a text abstract
\end{textabstract}

Hello \cite{DHMR08}
\cite{hand}
\cite{website}
\cite{turing}
\cite{algorand}
\cite{sealcrypto}
\cite{ong}
\cite{art1}
\cite{EPRINT:KleOneAki23}
\cite{art2}
\cite{DHMR08}
\ifusebibtex
\bibliography{main}
\else
\printbibliography
\fi
\end{document}

0 comments on commit b045ca9

Please sign in to comment.