2

I am trying to display a pH scale in LaTeX but Im having trouble figuring it out. All the googling I have been able to do just brings up the pH levels of Latex the material. Can someone offer some advice/resources?

5
  • 3
    Welcome to TeX.SX! The short answer is that this is possible but I have to warn you that questions of the form "Please draw this for me" that show no effort on the part of OP, often don't get answered. You will get more help if you post some code showing what you have tried and give a minimal working example. A quick search on TeX.SX for drawing functions (with tikz or pstricks) will give you an idea of where to start. At the very least tell us what this scale should look like.
    – user30471
    Commented Feb 12, 2020 at 12:22
  • 1
    Maybe tex.stackexchange.com/questions/141448/… could be a starting point?
    – Marijn
    Commented Feb 12, 2020 at 12:24
  • 1
    With no specifications, this also could be a start point: \documentclass{article} \usepackage[table]{xcolor} \begin{document} \begin{tabular}{p{1cm}p{1cm}p{1cm}} \hfil 0 & \hfil 7 & \hfil 14 \\ \cellcolor{red} & \cellcolor{green} & \cellcolor{blue}\\ \end{tabular} \end{document}
    – Fran
    Commented Feb 12, 2020 at 12:31
  • Unfortunatly I was not able to get any of these examples working, I do not know why but I eventually went with placing an image of the pH Scale in the document using \includegraphics Commented Feb 14, 2020 at 22:15
  • Did you put \usepackage{tikz} in your preamble? Commented Feb 15, 2020 at 0:20

1 Answer 1

7

Update: pH scale with colors in https://en.wikipedia.org/wiki/PH_indicator. (Paul Gaborit suggested)

enter image description here

\documentclass[tikz,border=5mm]{standalone}
\begin{document} 
\begin{tikzpicture}[xscale=.6,font=\sffamily]
\fill[left color=red,right color=orange]
(0,0) rectangle (3,1);
\fill[left color=orange,right color=green]
(3,0) rectangle (7.5,1);
\fill[left color=green,right color=blue]
(7.5,0) rectangle (12,1);
\fill[left color=blue,right color=violet]
(12,0) rectangle (15,1);
\draw[white] (0,0) grid (15,1);

\foreach \i in {0,...,14}
\path (\i+.5,0) node[below]{\i};
\path 
(0,1) node[above right]{Acidic}
(7.5,1) node[above]{Neutral}
(15,1) node[above left]{Alkaline};
\path (current bounding box.south) node[below=2mm,scale=1.5]{\bfseries pH scale};
\end{tikzpicture} 
\end{document}

I choose red for Axidic, violet for Neutral, and cyan for Alkaline. Tell me if you have a better choice of colors for pH scale.

enter image description here

\documentclass[tikz,border=5mm]{standalone} 
\begin{document} 
\begin{tikzpicture}[xscale=.6,font=\sffamily]
\fill[left color=red,middle color=violet,right color=cyan] (0,0) rectangle (15,1);
\draw[white] (0,0) grid (15,1);
\foreach \i in {0,...,14} \path (\i+.5,0) node[below]{\i};
\path 
(0,1) node[above right]{Acidic}
(7.5,1) node[above]{Neutral}
(15,1) node[above left]{Alkaline};
\path (current bounding box.south) node[below=2mm,scale=2]{\bfseries pH scale};
\end{tikzpicture} 
\end{document}
2

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .