Generalphysics in LaTeX

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
karin
Posts: 2
Joined: Wed Apr 09, 2008 9:55 pm

physics in LaTeX

Post by karin »

Hello!

I'm new on this forum. I have a problem with special symbols in LaTeX. I need to use \overbracket command quite a lot (for physicists: contraction symbol in QFT) and usually the brackets are overlapping each other. Is there a simple way to do it? Maybe some other command that works similarly?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

physics in LaTeX

Post by localghost »

Please provide some code in the sense of a minimal working example (MWE). This MWE must be compilable for any other user. As far as I remember the \overbracket command comes with the mathtools package from the mh bundle.


Best regards
Thorsten¹
karin
Posts: 2
Joined: Wed Apr 09, 2008 9:55 pm

physics in LaTeX

Post by karin »

I used the following code in the preamble:

Code: Select all

\makeatletter
\def\overbracket{\@ifnextchar [ {\@overbracket} {\@overbracket
[\@bracketheight]}}
\def\@overbracket[#1]{\@ifnextchar [ {\@over@bracket[#1]}
{\@over@bracket[#1][0.3em]}}
\def\@over@bracket[#1][#2]#3{%\message {Overbracket: #1,#2,#3}
\mathop {\vbox {\m@th \ialign {##\crcr \noalign {\kern 3\p@
\nointerlineskip }\downbracketfill {#1}{#2}
                              \crcr \noalign {\kern 3\p@ }
                              \crcr  $\hfil \displaystyle {#3}\hfil $%
                              \crcr} }}\limits}
\def\downbracketfill#1#2{$\m@th \setbox \z@ \hbox {$\braceld$}
                  \edef\@bracketheight{\the\ht\z@}\downbracketend{#1}{#2}
                  \leaders \vrule \@height #1 \@depth \z@ \hfill
                  \leaders \vrule \@height #1 \@depth \z@ \hfill
\downbracketend{#1}{#2}$}
\def\downbracketend#1#2{\vrule depth #2 width #1\relax}
The code is from:
http://www.texnik.de/cgi-bin/mainFAQ.cg ... et/bracket

The above code works good (similar to \overbrace), but when I have to make many intersecting brackets it starts to be painful. I didn't try the mathtools package. Perhaps I will.

Greets,
Karin
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Re: physics in LaTeX

Post by localghost »

This is not what is supposed to be a MWE. Your example code should show the undesired behaviour. Otherwise it's difficult to see what's going wrong.
Post Reply