TransWikia.com

Affiliations appear in unspaced italics, possible math mode triggered by breqn package

TeX - LaTeX Asked by Aritra Das on May 29, 2021

I recently found out about the breqn package and have been using it profusely. However, I notice that my article’s title section is thrown off by this package. Specifically, the affiliation part of my text appears without spacing and the compiler throws a missing $ inserted at the maketitle line. In constructing an MWE, I see that the breqn package is causing this glitch. How do I resolve this?

documentclass[%
reprint,
amsmath,amssymb,
aps,floatfix
]{revtex4-2}
usepackage{breqn}
usepackage{blindtext}
begin{document}
title{Sample title}
author{Aritra Das}
affiliation{Dept. of Physics, Indian Institute of Technology, Kanpur, Uttar Pradesh 208016, India}
date{today}
maketitle
section{Introduction}
blindtext
end{document}

Compiled document with error in affiliation text
Any help is appreciated, thanks.

One Answer

Nice find!

The revtex4-2 class loads the affiliation under a setting where the comma is made active, with replacement text active@comma. But breqn defines the active comma in a very different way, only useful in math mode.

The solution is to not use breqn, of course. If you insist on it:

documentclass[
  reprint,
  amsmath,amssymb,
  aps,floatfix
]{revtex4-2}

usepackage{breqn}
usepackage{blindtext}

%%% let's try and fix the issue
begingroupmakeatletter
catcode`,=active
globalletbreqn@comma,
protectedgdef,{ifmmodeexpandafterbreqn@commaelseexpandafteractive@commafi}
endgroup

begin{document}

title{Sample title}
author{Aritra Das}
affiliation{Dept. of Physics, Indian Institute of Technology, Kanpur, Uttar Pradesh 208016, India}
date{today}

maketitle

section{Introduction}

$a,b$

blindtext

end{document}

An alternative workaround is

usepackage{etoolbox}

makeatletter
patchcmdaffils@present@group
 {frontmatter@affiliationfont}
 {frontmatter@affiliationfontbegingrouplccode`~=`,lowercase{endgrouplet~}active@comma}
 {}{}
makeatother

which assigns the intended meaning to the active comma when affiliations are indeed used for typesetting.

Correct answer by egreg on May 29, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP