From 9f5c8fe512b5eaa00d00111e935c16ca1411b6e7 Mon Sep 17 00:00:00 2001 From: adin Date: Thu, 15 Jun 2023 15:01:49 +0200 Subject: [PATCH 1/4] Port to biblatex using standard IEEE style --- cvpr.sty | 66 ++++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 48 insertions(+), 18 deletions(-) diff --git a/cvpr.sty b/cvpr.sty index de56c2c..db70f0d 100644 --- a/cvpr.sty +++ b/cvpr.sty @@ -18,24 +18,20 @@ % * "rebuttal" for the author rebuttal. % % specify references as -% {\small -% \bibliographystyle{ieee} -% \bibliography{...your files...} -% } +% \addbibresource{references.bib} +% in the preamble % --------------------------------------------------------------- \NeedsTeXFormat{LaTeX2e}[1999/12/01] \ProvidesPackage{cvpr}[2024 Example LaTex class for IEEE CVPR] \RequirePackage{times} % Integrate Times for here -\RequirePackage{cite} % Automatically ordered citations \RequirePackage{xspace} \RequirePackage{graphicx} \RequirePackage{amsmath} \RequirePackage{amssymb} \RequirePackage{booktabs} -\RequirePackage[numbers,sort&compress]{natbib} -\setlength{\bibsep}{1pt plus 1pt minus 1pt} +%\setlength{\bibsep}{1pt plus 1pt minus 1pt} \RequirePackage{silence} % Suppress unwanted warnings \hbadness=10000 \vbadness=10000 \vfuzz=30pt \hfuzz=30pt @@ -43,13 +39,51 @@ \WarningFilter{latex}{Font shape} \WarningFilter{hyperref}{Token not allowed in a PDF string} \WarningFilter[rebuttal]{latex}{No \author given} -\RequirePackage{etoolbox} +\RequirePackage{etoolbox}%% <- for \pretocmd, \apptocmd and \patchcmd % Use modern caption package to allow for sub-figures etc. % Reproduces the original CVPR/ICCV style as closely as possible. \RequirePackage[format=plain,labelformat=simple,labelsep=period,font=small,compatibility=false]{caption} \RequirePackage[font=footnotesize,skip=3pt,subrefformat=parens]{subcaption} +%% References + +% Breaking lines for URLs in the bib +\RequirePackage[hyphens]{url} +%todo check if this below is needed +\Urlmuskip=0mu plus 1mu\relax + +\RequirePackage[ +backend=biber, +style=ieee, +sorting=noneyear, +backref=true, +natbib=true, % add citep and citet +giveninits=true, % abbreviate the authors names, i.e., put only the initials +]{biblatex} + +% Remove strings from the pageref +\DefineBibliographyStrings{english}{% + backrefpage =,% originally "cited on page" + backrefpages =,% originally "cited on pages" +} + +% Remove spurious white space from pageref when using no string +\patchcmd{\abx@macro@pageref}{\ppspace}{}{}{\PackageWarningNoLine{cvpr}{Error patching pageref bibmacro. Let the maintainers know that the patch is not working.}} + + +% Sorts by appearance globally and by year within the citation +% https://tex.stackexchange.com/a/55451/7561 +\DeclareSortingTemplate{noneyear}{ + \sort{\citeorder} + \sort{\field{year}} + \sort{\field{author}} +} + +% Change the normal space to a non-breaking one between the names and the reference +% https://tex.stackexchange.com/a/74932/7561 +\renewcommand\namelabeldelim{\addnbspace} + \newtoggle{cvprfinal} % Camera-ready version \newtoggle{cvprrebuttal} % Rebuttal @@ -68,9 +102,7 @@ \ActivateWarningFilters[rebuttal] }{} -% Breaking lines for URLs in the bib -\RequirePackage[hyphens]{url} -\Urlmuskip=0mu plus 1mu\relax + % --------------------------------------------------------------- @@ -395,12 +427,12 @@ \PackageWarningNoLine{cvpr}{Package `hyperref' is not loaded, but highly recommended for camera-ready version} } }{% - \@ifpackageloaded{hyperref}{ - \@ifpackagewith{hyperref}{pagebackref}{}{ - \PackageWarningNoLine{cvpr}{Package `hyperref' is not loaded with option `pagebackref', which is strongly recommended for review version} + \@ifpackageloaded{biblatex}{ + \@ifpackagewith{biblatex}{backref}{}{ + \PackageWarningNoLine{cvpr}{Package `biblatex' is not loaded with option `backref', which is strongly recommended for review version} } }{% - \PackageWarningNoLine{cvpr}{Package `hyperref' is not loaded, but strongly recommended for review version} + \PackageWarningNoLine{cvpr}{Package `biblatex' is not loaded, but strongly recommended for review version} } } } @@ -505,8 +537,6 @@ % Patch amsmath commands so that the previous line and the equation itself % are numbered. Bug: multiline has an extra line number. % https://tex.stackexchange.com/questions/461186/how-to-use-lineno-with-amsmath-align -\RequirePackage{etoolbox} %% <- for \pretocmd, \apptocmd and \patchcmd - \newcommand*\linenomathpatch[1]{% \expandafter\pretocmd\csname #1\endcsname {\linenomath}{}{}% \expandafter\pretocmd\csname #1*\endcsname {\linenomath}{}{}% @@ -592,7 +622,7 @@ % --------------------------------------------------------------- -%% redefine the \title command so that a variable name is saved in \thetitle, and provides the \maketitlesupplementary command +%% redefine the \title command so that a variable name is saved in \thetitle, and provides the \maketitlesupplementary command \let\titleold\title \renewcommand{\title}[1]{\titleold{#1}\newcommand{\thetitle}{#1}} \def\maketitlesupplementary From 40bc5efd5e5949c2316b1266f938280886b6968c Mon Sep 17 00:00:00 2001 From: adin Date: Thu, 15 Jun 2023 15:02:01 +0200 Subject: [PATCH 2/4] Use biblatex instead of bibtex --- main.tex | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/main.tex b/main.tex index c26d03d..3d2e5d1 100644 --- a/main.tex +++ b/main.tex @@ -1,3 +1,4 @@ +% !BIB program=biber % CVPR 2024 Paper Template; see https://github.com/cvpr-org/author-kit \documentclass[10pt,twocolumn,letterpaper]{article} @@ -12,12 +13,15 @@ % It is strongly recommended to use hyperref, especially for the review version. % hyperref with option pagebackref eases the reviewers' job. -% Please disable hyperref *only* if you encounter grave issues, +% Please disable hyperref *only* if you encounter grave issues, % e.g. with the file validation for the camera-ready version. % % If you comment hyperref and then uncomment it, you should delete *.aux before re-running LaTeX. % (Or just hit 'q' on the first LaTeX run, let it finish, and you should be clear). -\usepackage[pagebackref,breaklinks,colorlinks]{hyperref} +\usepackage[breaklinks,colorlinks]{hyperref} + +% Add your own bibliography +\addbibresource{main.bib} %%%%%%%%% PAPER ID - PLEASE UPDATE \def\paperID{*****} % *** Enter the Paper ID here @@ -46,15 +50,13 @@ \begin{document} \maketitle -\input{sec/0_abstract} +\input{sec/0_abstract} \input{sec/1_intro} \input{sec/2_formatting} \input{sec/3_finalcopy} -{ - \small - \bibliographystyle{ieeenat_fullname} - \bibliography{main} -} + +\printbibliography + \input{sec/X_suppl} \end{document} From 67050c4db7b37a6bbce1bc67eb4439a9ea1a4e25 Mon Sep 17 00:00:00 2001 From: adin Date: Tue, 20 Jun 2023 12:42:28 +0200 Subject: [PATCH 3/4] Fix patch and add missing style --- cvpr.sty | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/cvpr.sty b/cvpr.sty index db70f0d..fc22faf 100644 --- a/cvpr.sty +++ b/cvpr.sty @@ -40,6 +40,7 @@ \WarningFilter{hyperref}{Token not allowed in a PDF string} \WarningFilter[rebuttal]{latex}{No \author given} \RequirePackage{etoolbox}%% <- for \pretocmd, \apptocmd and \patchcmd +\RequirePackage{xpatch}% for patching biblatex % Use modern caption package to allow for sub-figures etc. % Reproduces the original CVPR/ICCV style as closely as possible. @@ -64,13 +65,17 @@ giveninits=true, % abbreviate the authors names, i.e., put only the initials % Remove strings from the pageref \DefineBibliographyStrings{english}{% - backrefpage =,% originally "cited on page" - backrefpages =,% originally "cited on pages" + backrefpage ={},% originally "cited on page" + backrefpages ={},% originally "cited on pages" } -% Remove spurious white space from pageref when using no string -\patchcmd{\abx@macro@pageref}{\ppspace}{}{}{\PackageWarningNoLine{cvpr}{Error patching pageref bibmacro. Let the maintainers know that the patch is not working.}} +% Removes the parenthesis from the backref +%\DeclareFieldFormat{nobackrefparens}{#1} +%\xpatchbibmacro{pageref}{parens}{nobackrefparens}{}{\PackageWarningNoLine{cvpr}{Error patching pageref bibmacro. Let the maintainers know that the patch is not working.}} +% Remove spurious white space from pageref when using no string +\xpatchbibmacro{pageref}{\ppspace}{}{}{\PackageWarningNoLine{cvpr}{Error patching pageref bibmacro. Let the maintainers know that the patch is not working.}} +\xpatchbibmacro{pageref}{\ppspace}{}{}{\PackageWarningNoLine{cvpr}{Error patching pageref bibmacro. Let the maintainers know that the patch is not working.}} % Sorts by appearance globally and by year within the citation % https://tex.stackexchange.com/a/55451/7561 @@ -84,6 +89,12 @@ giveninits=true, % abbreviate the authors names, i.e., put only the initials % https://tex.stackexchange.com/a/74932/7561 \renewcommand\namelabeldelim{\addnbspace} +% Make the fontsize small +\renewcommand*{\bibfont}{\normalfont\small} + +% Remove quotes from titles +\DeclareFieldFormat*{title}{#1} + \newtoggle{cvprfinal} % Camera-ready version \newtoggle{cvprrebuttal} % Rebuttal @@ -427,13 +438,14 @@ giveninits=true, % abbreviate the authors names, i.e., put only the initials \PackageWarningNoLine{cvpr}{Package `hyperref' is not loaded, but highly recommended for camera-ready version} } }{% - \@ifpackageloaded{biblatex}{ - \@ifpackagewith{biblatex}{backref}{}{ - \PackageWarningNoLine{cvpr}{Package `biblatex' is not loaded with option `backref', which is strongly recommended for review version} - } - }{% - \PackageWarningNoLine{cvpr}{Package `biblatex' is not loaded, but strongly recommended for review version} - } + %todo biblatex options are not recognized since it is not "loaded" now. Probably, we need to add some check up code as suggested here https://tex.stackexchange.com/a/287673/7561 +% \@ifpackageloaded{biblatex}{ +% \@ifpackagewith{biblatex}{backref}{}{ +% \PackageWarningNoLine{cvpr}{Package `biblatex' is not loaded with option `backref', which is strongly recommended for review version} +% } +% }{% +% \PackageWarningNoLine{cvpr}{Package `biblatex' is not loaded, but strongly recommended for review version} +% } } } From ba3f9b4ae92cad3072ca49aeaf498fa4b253bc3a Mon Sep 17 00:00:00 2001 From: adin Date: Wed, 21 Jun 2023 10:35:47 +0200 Subject: [PATCH 4/4] Update style to match CVPR --- cvpr.sty | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/cvpr.sty b/cvpr.sty index fc22faf..8a5203f 100644 --- a/cvpr.sty +++ b/cvpr.sty @@ -69,6 +69,8 @@ giveninits=true, % abbreviate the authors names, i.e., put only the initials backrefpages ={},% originally "cited on pages" } +%% Adapting the default style to CVPR's quirks + % Removes the parenthesis from the backref %\DeclareFieldFormat{nobackrefparens}{#1} %\xpatchbibmacro{pageref}{parens}{nobackrefparens}{}{\PackageWarningNoLine{cvpr}{Error patching pageref bibmacro. Let the maintainers know that the patch is not working.}} @@ -77,6 +79,28 @@ giveninits=true, % abbreviate the authors names, i.e., put only the initials \xpatchbibmacro{pageref}{\ppspace}{}{}{\PackageWarningNoLine{cvpr}{Error patching pageref bibmacro. Let the maintainers know that the patch is not working.}} \xpatchbibmacro{pageref}{\ppspace}{}{}{\PackageWarningNoLine{cvpr}{Error patching pageref bibmacro. Let the maintainers know that the patch is not working.}} +% Revert unit divider to period +\renewcommand*\newunitpunct{\addperiod\addspace} + +% Change format of volume-number-editor +\DeclareFieldFormat*{volume}{#1} + +\renewbibmacro*{volume+number+eid}{% + \printfield{volume}% + \printfield[parens]{number}% + \setunit{\addcolon\addspace}% + \printfield{eid}% +} + +% Change pages separator to colon on article +\renewcommand{\bibpagespunct}{\ifentrytype{article}{\addcolon\addspace}{\addcomma\addspace}} +\DeclareFieldFormat[article,incollection]{pages}{#1} + +% Remove quotes from titles +\DeclareFieldFormat*{title}{#1} + + + % Sorts by appearance globally and by year within the citation % https://tex.stackexchange.com/a/55451/7561 \DeclareSortingTemplate{noneyear}{ @@ -92,8 +116,6 @@ giveninits=true, % abbreviate the authors names, i.e., put only the initials % Make the fontsize small \renewcommand*{\bibfont}{\normalfont\small} -% Remove quotes from titles -\DeclareFieldFormat*{title}{#1} \newtoggle{cvprfinal} % Camera-ready version