LaTeX forum ⇒ Graphics, Figures & TablesAcid-Base Pairs

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

Acid-Base Pairs

Postby ghostanime2001 » Tue Dec 13, 2011 8:11 am

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.

Tags:

User avatar
cgnieder
Site Moderator
Posts: 1993
Joined: Sat Apr 16, 2011 7:27 pm

Postby cgnieder » Tue Dec 13, 2011 12:42 pm

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:
  1. \documentclass{article}
  2. \usepackage{chemmacros}
  3.  
  4. \begin{document}
  5.  
  6. \ce{\OX{b1,CO3^2-} + \OX{a2,H2O} <=> \OX{a1,HCO3-} + \OX{b2,OH-}}
  7. \redox(b1,a1){} \redox(b2,a2)[][-1]{}
  8.  
  9. \end{document}
site moderator & package author

ghostanime2001
Posts: 402
Joined: Fri May 20, 2011 9:41 am

Postby ghostanime2001 » Wed Dec 14, 2011 10:36 am

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

  1. \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-}}$}
  2. \ncbar[linewidth=0.1pt,angle=-90,nodesep=3pt,arm=0.5em]{A}{C}
  3. \ncbar[linewidth=0.1pt,angle=-90,nodesep=3pt,arm=1.1em]{B}{D}

User avatar
cgnieder
Site Moderator
Posts: 1993
Joined: Sat Apr 16, 2011 7:27 pm

Postby cgnieder » Wed Dec 14, 2011 10:43 am

Please add a compilable minimal example.
site moderator & package author

ghostanime2001
Posts: 402
Joined: Fri May 20, 2011 9:41 am

Postby ghostanime2001 » Wed Dec 14, 2011 10:55 am

Compile with XeLaTeX

  1. \documentclass[fleqn]{article}
  2. \usepackage{amsfonts}
  3. \usepackage{amsmath}
  4. \usepackage{amssymb}
  5. \usepackage{amstext}
  6. \usepackage{amsthm}
  7. \usepackage{array}
  8. \usepackage{booktabs}
  9. \usepackage{calc}
  10. \usepackage{cancel}
  11. \usepackage{chemfig}
  12. \usepackage{chemmacros}
  13. \usepackage[shortlabels,inline]{enumitem}
  14. \usepackage{fix-cm}
  15. \usepackage[T1]{fontenc}
  16. \usepackage{fouridx}
  17. \usepackage{fullpage}
  18. \usepackage[margin=1in]{geometry}
  19. \usepackage{graphicx}
  20. \usepackage[utf8]{inputenc}
  21. \usepackage{lewis}
  22. \usepackage{mathtools}
  23. \usepackage[version=3]{mhchem}
  24. \usepackage{multienum}
  25. \usepackage{multirow}
  26. \usepackage{pbox}
  27. \usepackage{pgfkeys}
  28. \usepackage{pifont}
  29. \usepackage{pstricks}
  30. \usepackage{pst-node}
  31. \usepackage{pst-plot}
  32. \usepackage{siunitx}
  33. \usepackage{textcomp}
  34. \usepackage{tikz}
  35. \usepackage{type1cm}
  36. \usepackage{ulem}
  37. \usepackage{wasysym}
  38. \usepackage{xfrac}
  39. \usepackage{xspace}
  40. \setlength{\parindent}{0in}
  41. \setlength{\parskip}{0in}
  42. \setlength{\mathindent}{0in}
  43. \newlist{longenum}{enumerate}{6}
  44. \setlist[longenum,1]{label=\arabic*.}
  45. \setlist[longenum,2]{label=\alph*)}
  46. \setlist[longenum,3]{label=\alph*)}
  47. \setlist[longenum,4]{label=\alph*)}
  48. \setlist[longenum,5]{label=\alph*)}
  49. \setlist[longenum,6]{label=\alph*)}
  50. \newcommand{\since}{\raisebox{0.56pt}{\rotatebox[origin=c]{180}{$\Large\wasytherefore$}}}
  51. \newcommand{\thus}{\Large{\wasytherefore}}
  52. \newcommand{\s}{\par\medskip}
  53. \newcommand{\ssa}{\\ \addlinespace[\smallskipamount]}
  54. \newcommand{\msa}{\\ \addlinespace[\medskipamount]}
  55. \newcommand{\bsa}{\\ \addlinespace[\bigskipamount]}
  56. \allowdisplaybreaks
  57. \pagestyle{empty}
  58. \begin{document}
  59. \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-}}$}
  60. \ncbar[linewidth=0.1pt,angle=-90,nodesep=3pt,arm=0.5em]{A}{C}
  61. \ncbar[linewidth=0.1pt,angle=-90,nodesep=3pt,arm=1.1em]{B}{D}
  62. \end{document}

User avatar
cgnieder
Site Moderator
Posts: 1993
Joined: Sat Apr 16, 2011 7:27 pm

Postby cgnieder » Wed Dec 14, 2011 11:25 am

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:
  1. \usepackage{siunitx,tikz,xfrac,xspace,amsmath,chemmacros}
  2. \usepackage[version=3]{mhchem}

and this
  1. \usepackage{chemmacros}

will work the same way
site moderator & package author

ghostanime2001
Posts: 402
Joined: Fri May 20, 2011 9:41 am

Postby ghostanime2001 » Wed Dec 14, 2011 11:27 am

So i can substitute all those packages with just 1 package?

User avatar
cgnieder
Site Moderator
Posts: 1993
Joined: Sat Apr 16, 2011 7:27 pm

Postby cgnieder » Wed Dec 14, 2011 11:32 am

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


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 8 guests