Graphics, Figures & TablesAcid-Base Pairs

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
ghostanime2001
Posts: 402
Joined: Fri May 20, 2011 9:41 am

Acid-Base Pairs

Post by ghostanime2001 »

How do you produce acid-base lines with chemical equations? Sort of like redox lines but for conjugate acid-base pairs. Also how do you make the lines flow below the chemical reaction?
Last edited by ghostanime2001 on Fri Dec 16, 2011 11:42 pm, edited 1 time in total.

Recommended reading 2024:

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

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

cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Acid-Base Pairs

Post by cgnieder »

I do not know what you mean by making lines flow. I also don't know what you mean by acid-base lines? Do you mean a line which connects them visually above or below the equation? You could "misuse" chemmacros' \redox command:

Code: Select all

\documentclass{article}
\usepackage{chemmacros}

\begin{document}

\ce{\OX{b1,CO3^2-} + \OX{a2,H2O} <=>  \OX{a1,HCO3-} + \OX{b2,OH-}}
\redox(b1,a1){} \redox(b2,a2)[][-1]{}

\end{document}
site moderator & package author
ghostanime2001
Posts: 402
Joined: Fri May 20, 2011 9:41 am

Acid-Base Pairs

Post by ghostanime2001 »

This is what I mean. Can this code be improved?

Code: Select all

\ce{$\underset{\clap{\begin{tabular}[t]{@{}c@{}}\Rnode{A}{acid}\end{tabular}}}{\ce{HCO3-}}$ + $\underset{\clap{\begin{tabular}[t]{@{}c@{}}\Rnode{B}{base}\end{tabular}}}{\ce{S^{2-}}}$ <=> $\underset{\clap{\begin{tabular}[t]{@{}c@{}}\Rnode{C}{base}\end{tabular}}}{\ce{CO3^{2-}}}$ + $\underset{\clap{\begin{tabular}[t]{@{}c@{}}\Rnode{D}{acid}\end{tabular}}}{\ce{HS-}}$}
\ncbar[linewidth=0.1pt,angle=-90,nodesep=3pt,arm=0.5em]{A}{C}
\ncbar[linewidth=0.1pt,angle=-90,nodesep=3pt,arm=1.1em]{B}{D}
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Re: Acid-Base Pairs

Post by cgnieder »

Please add a compilable minimal example.
site moderator & package author
ghostanime2001
Posts: 402
Joined: Fri May 20, 2011 9:41 am

Acid-Base Pairs

Post by ghostanime2001 »

Compile with XeLaTeX

Code: Select all

\documentclass[fleqn]{article} 
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amstext}
\usepackage{amsthm}
\usepackage{array}
\usepackage{booktabs}
\usepackage{calc}
\usepackage{cancel}
\usepackage{chemfig}
\usepackage{chemmacros}
\usepackage[shortlabels,inline]{enumitem}
\usepackage{fix-cm}
\usepackage[T1]{fontenc}
\usepackage{fouridx}
\usepackage{fullpage} 
\usepackage[margin=1in]{geometry} 
\usepackage{graphicx}
\usepackage[utf8]{inputenc}
\usepackage{lewis}
\usepackage{mathtools}
\usepackage[version=3]{mhchem}
\usepackage{multienum}
\usepackage{multirow}
\usepackage{pbox}
\usepackage{pgfkeys}
\usepackage{pifont}
\usepackage{pstricks}
\usepackage{pst-node}
\usepackage{pst-plot}
\usepackage{siunitx}
\usepackage{textcomp}
\usepackage{tikz}
\usepackage{type1cm}
\usepackage{ulem}
\usepackage{wasysym}
\usepackage{xfrac}
\usepackage{xspace}
\setlength{\parindent}{0in}
\setlength{\parskip}{0in}
\setlength{\mathindent}{0in}
\newlist{longenum}{enumerate}{6}
\setlist[longenum,1]{label=\arabic*.}
\setlist[longenum,2]{label=\alph*)}
\setlist[longenum,3]{label=\alph*)}
\setlist[longenum,4]{label=\alph*)}
\setlist[longenum,5]{label=\alph*)}
\setlist[longenum,6]{label=\alph*)}
\newcommand{\since}{\raisebox{0.56pt}{\rotatebox[origin=c]{180}{$\Large\wasytherefore$}}}
\newcommand{\thus}{\Large{\wasytherefore}}
\newcommand{\s}{\par\medskip}
\newcommand{\ssa}{\\ \addlinespace[\smallskipamount]}
\newcommand{\msa}{\\ \addlinespace[\medskipamount]}
\newcommand{\bsa}{\\ \addlinespace[\bigskipamount]}
\allowdisplaybreaks
\pagestyle{empty}
\begin{document}
\ce{$\underset{\clap{\begin{tabular}[t]{@{}c@{}}\Rnode{A}{acid}\end{tabular}}}{\ce{HCO3-}}$ + $\underset{\clap{\begin{tabular}[t]{@{}c@{}}\Rnode{B}{base}\end{tabular}}}{\ce{S^{2-}}}$ <=> $\underset{\clap{\begin{tabular}[t]{@{}c@{}}\Rnode{C}{base}\end{tabular}}}{\ce{CO3^{2-}}}$ + $\underset{\clap{\begin{tabular}[t]{@{}c@{}}\Rnode{D}{acid}\end{tabular}}}{\ce{HS-}}$}
\ncbar[linewidth=0.1pt,angle=-90,nodesep=3pt,arm=0.5em]{A}{C}
\ncbar[linewidth=0.1pt,angle=-90,nodesep=3pt,arm=1.1em]{B}{D}
\end{document}
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Acid-Base Pairs

Post by cgnieder »

The result looks fine to me. What is it exactly you want to improve?

BTW: your example code is far from being minimal. For example you're loading lot's of packages twice: siunitx, tikz, xfrac, xspace, mhchem and mathtools (=improved amsmath) are already loaded by chemmacros.
This:

Code: Select all

\usepackage{siunitx,tikz,xfrac,xspace,amsmath,chemmacros}
\usepackage[version=3]{mhchem}
and this

Code: Select all

\usepackage{chemmacros}
will work the same way
site moderator & package author
ghostanime2001
Posts: 402
Joined: Fri May 20, 2011 9:41 am

Re: Acid-Base Pairs

Post by ghostanime2001 »

So i can substitute all those packages with just 1 package?
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Re: Acid-Base Pairs

Post by cgnieder »

This is no substitution. These packages are loaded anyway by chemmacros, if you need them or not. tikz for example is also loaded by chemfig so if you use the latter you won't have to load tikz by yourself.
site moderator & package author
Post Reply