Math & ScienceTypesetting a Line over Text

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
hoytesara
Posts: 13
Joined: Sat Feb 18, 2012 10:46 am

Typesetting a Line over Text

Post by hoytesara »

In my thesis I need to have a line over the formulas for some of my complexes to denote which atoms are coordinated to the metal, as shown in the above image. How do I go about typesetting this?
Attachments
overbracket.png
overbracket.png (20.81 KiB) Viewed 5468 times

Recommended reading 2024:

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

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
Stefan Kottwitz
Site Admin
Posts: 10359
Joined: Mon Mar 10, 2008 9:44 pm

Typesetting a Line over Text

Post by Stefan Kottwitz »

Hi,

welcome to the board!

You could use the mathtools package and the command \overbracket. For example:

Code: Select all

\documentclass{article}
\usepackage{mathtools}
\begin{document}
\[
    \overbracket{\text{Formula}}
\]
 \end{document}
You can adjust it by giving values to the optional arguments, the syntax is

\overbracket[line thickness][bracket height]{formula}

Stefan
LaTeX.org admin
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Typesetting a Line over Text

Post by cgnieder »

You could also misuse chemmacros' \redox command:

Code: Select all

\documentclass{article}
\usepackage{chemmacros}
\begin{document}

\ch{[\OX{a,Pt}(CH2)CH=CH\OX{b,C}(CH2)2(dppp)]}\redox(a,b){}

\end{document}
lineover.png
lineover.png (5.09 KiB) Viewed 5458 times
Regards
site moderator & package author
hoytesara
Posts: 13
Joined: Sat Feb 18, 2012 10:46 am

Typesetting a Line over Text

Post by hoytesara »

The \redox command suits perfectly. However, in order to make everything work properly, I had to modify things slightly. What I ended up going with was:

Code: Select all

\documentclass{article}
\usepackage{chemmacros}
\usepackage[version=3]{mhchem}
\usetikzlibrary{calc}
\begin{document}

\ce{[\OX{a,Pt}(CH2)CH=CH\OX{b,C}(CH2)2(dppp)]}\redox(a,b){}

\end{document}
Thanks!
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Typesetting a Line over Text

Post by cgnieder »

Didn't it work without \usetikzlibrary{calc}? That would mean you must have an old (and obviously buggy) version of chemmacros.
site moderator & package author
Post Reply