TeX - LaTeX Asked by Mironline on February 17, 2021
I want to add the following symbols to show the connection between some data-models in .tex
document, I was wondering to know whether we have any predefined code (latex of Unicode) for them, or I have to use pictures.
Here's a proposal:
documentclass{article}
usepackage{amsmath}
newcommand{ljoinrel}[1]{mathrel{mspace{-#1mu}}}
newcommand{negljoinrel}[1]{mathrel{mspace{#1mu}}}
newcommand{One}{%
relbarljoinrel{4}relbarljoinrel{4}relbar
ljoinrel{14}mapstocharnegljoinrel{14}%
}
newcommand{Many}{%
relbarljoinrel{4}relbarljoinrel{4}relbar
ljoinrel{14}<%
}
newcommand{Oone}{%
relbarljoinrel{7}relbarljoinrel{7}relbarljoinrel{6}relbar
ljoinrel{14}mapstocharnegljoinrel{6}mapstocharnegljoinrel{6}%
}
newcommand{Onemany}{%
relbarljoinrel{4}relbarljoinrel{4}relbar
ljoinrel{14}mapstochar<%
}
newcommand{Zeroone}{%
relbarljoinrel{11}relbarjoinrel
mathrel{circ}joinrel
relbarljoinrel{8}mapstocharnegljoinrel{8}%
}
newcommand{Zeromany}{%
relbarljoinrel{11}relbarjoinrel
mathrel{circ}joinrel
relbarljoinrel{14}<%
}
begin{document}
sbox0{$One$}showthewd0
sbox0{$Many$}showthewd0
sbox0{$Oone$}showthewd0
sbox0{$Onemany$}showthewd0
sbox0{$Zeroone$}showthewd0
sbox0{$Zeromany$}showthewd0
$A One B$
$A Many B$
$A Oone B$
$A Onemany B$
$A Zeroone B$
$A Zeromany B$
end{document}
Correct answer by egreg on February 17, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP