TransWikia.com

Fraction in pmod bracket

TeX - LaTeX Asked by user109351 on January 31, 2021

I want to put a fraction into the pmod brackets in math mode, i.e

documentclass{article}
usepackage{amsmath}
begin{document}
[xequiv ypmod{frac{a}{b}}]
end{document}

However, the brackets don’t become bigger, just like

left( right)

to fit with the fraction. How to fix it?

2 Answers

The below thing also works fine, though its bmod, and not pmod, still

text{something} equiv 13 left(bmod dfrac{545ell^{45}}{541p^P{p-1}}right)

Output: enter image description here

Answered by Srijon Sarkar on January 31, 2021

You can use the approach of mathtools with DeclarePairedDelimiter:

documentclass{article}
usepackage{amsmath,mathtools,xparse}

DeclarePairedDelimiterparens{(}{)}
makeatletter
RenewDocumentCommand{pod}{sO{}m}{%
  allowbreak
  if@display
    mkern 18mu
  else
    mkern 8mu
  fi
  IfBooleanTF{#1}{parens*{#3}}{parens[#2]{#3}}%
}
RenewDocumentCommand{pmod}{sO{}m}{%
  IfBooleanTF{#1}
    {pod*{{operator@font mod}mkern 6mu#3}}
    {pod[#2]{{operator@font mod}mkern 6mu#3}}%
}

begin{document}
[
xequiv ypmod*{frac{a}{b}}
]
[
xequiv ypmod[Big]{frac{a}{b}}
]
end{document}

enter image description here

Note that you can use pod with the same syntax as well (which omits the “mod”).

Answered by egreg on January 31, 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