Math & Science ⇒ Typesetting "pH"
Typesetting "pH"
Should I typeset "pH" in mathmode, or is it ok to use textmode? Technically it's a mathmatical function but I'm not sure...!
Thanks
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
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Typesetting "pH"
Best regards and welcome to the board
Thorsten
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Re: Typesetting "pH"
Turns out I already had siunitx installed - quite new to all this! But, it doesn't seem to recognise "pH" as a unit and I couldn't find any information about it in the instructions [just to check i tried "\si{\meter}" and that works]. I guess I should just leave it as normal text in a paragraph, the paper I'm reading at the moment has it formatted as normal text so I'm sure it's ok.
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Typesetting "pH"
Code: Select all
\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage{siunitx}
\DeclareSIUnit{\pH}{pH}
\begin{document}
\SI{7}{\pH}
\end{document}
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Typesetting "pH"
That being said, chemmacros offers commands for pH as well as for pKa and pKb and other uses of the p operator:The operator p [...] shall be printed in Roman type. (p 103)
Code: Select all
\documentclass{article}
\usepackage{chemmacros,siunitx}
\begin{document}
The \pH\ of the solution is $\pH = \num{4.3}$
The \pKa of acetic acid is $\pKa = \num{4.7}$
\begin{align*}
\Ka \times \Kb &= 10^{-14} \\
\pKa + \pKb &= 14
\end{align*}
\end{document}
BTW: the pH is not a unit! The Green Book again (emphasis by me): “The quantity pH is defined […]”
Typesetting "pH"
\usepackage{chemmacros}
in the preamble and I can't figure it out.Console says:
Code: Select all
Runaway argument?
{\(\underset {\bool_if:NF \l_chemformula_name_width_bool {\width_to_dim:Nn \ETC
.
! File ended while scanning use of \NewDocumentCommand.
<inserted text>
\par
l.43 \bool_new:N
\l_chemmacros_version_one_bool
?
Re: Typesetting "pH"
Regards