<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{sliderule}[2022/08/22 Slide rule tools]

\RequirePackage{tikz}
\RequirePackage{ifthen}


% Scale functions:
% See https://sliderulemuseum.com/SR_Scales.htm
%
% l: length of the rule
% n: the number on the rule
%
% A/B: (l/2) * log(n)
% C/D: l / log(n)
% CI: abs(l * log(10 / n) - l)
% K: (l/3) * log(n)
%
% L: n * l
% T: l * log(10 * tan(n))
% S: l * log(10 * sin(n))

\def\sliderulewidth{10}

\def\abscalefn(#1){(\sliderulewidth/2) * log10(#1)}
\def\cdscalefn(#1){(\sliderulewidth * log10(#1))}
\def\ciscalefn(#1){(\sliderulewidth - \cdscalefn(#1))}
\def\kscalefn(#1){(\sliderulewidth/3) * log10(#1)}
\def\lscalefn(#1){(\sliderulewidth * #1)}
\def\tscalefn(#1){(\sliderulewidth * log10(10 * tan(#1)))}
\def\sscalefn(#1){(\sliderulewidth * log10(10 * sin(#1)))}


% Arguments:
% Label
% x of start
% y of start
\newcommand{\linearscale}[3]{
	\draw[black] ({#1}, #2) -- ({#1 + \sliderulewidth}, #2);
	\draw[black] ({#1}, #2 + 0.9) -- ({#1 + \sliderulewidth}, #2 + 0.9);
	\draw[black] ({#1}, #2 + 0.9) -- ({#1}, #2 + 0.7);
	\draw[black] ({#1 + \sliderulewidth}, #2 + 0.9) -- ({#1 + \sliderulewidth}, #2 + 0.7);

	\draw ({#1 - 0.1}, #2 + 0.5) node[left] {#3};

	% Numbers and marks
	\foreach \i in {0,..., 10}{
		\draw[black]
			({#1 + (\sliderulewidth / 10) * \i}, #2) --
			({#1 + (\sliderulewidth / 10) * \i}, #2 + 0.3)
			node[above] {\i};
	}

	% Submarks
	\foreach \n in {0, ..., 9} {
		\foreach \i in {1,..., 9} {
			\ifthenelse{\i=5}{
				\draw[black]
					({#1 + (\sliderulewidth / 10) * (\n + \i / 10)}, #2) --
					({#1 + (\sliderulewidth / 10) * (\n + \i / 10)}, #2 + 0.2);
			} {
				\draw[black]
					({#1 + (\sliderulewidth / 10) * (\n + \i / 10)}, #2) --
					({#1 + (\sliderulewidth / 10) * (\n + \i / 10)}, #2 + 0.1);
			}
		}
	}
}


% Arguments:
% Label
% x of start
% y of start
\newcommand{\abscale}[3]{
	\draw[black] ({#1}, #2) -- ({#1 + \sliderulewidth}, #2);
	\draw[black] ({#1}, #2 + 0.9) -- ({#1 + \sliderulewidth}, #2 + 0.9);
	\draw[black] ({#1}, #2 + 0.9) -- ({#1}, #2 + 0.7);
	\draw[black] ({#1 + \sliderulewidth}, #2 + 0.9) -- ({#1 + \sliderulewidth}, #2 + 0.7);


	\draw ({#1 - 0.1}, #2 + 0.5) node[left] {#3};

	% Numbers and marks 1 - 9
	\foreach \i in {1,..., 9}{
		\draw[black]
			({#1 + \abscalefn(\i)}, #2) --
			({#1 + \abscalefn(\i)}, #2 + 0.3)
			node[above] {\i};
	}
	% Numbers and marks 10 - 100
	\foreach \i in {1,..., 10}{
		\draw[black]
			({#1 + \abscalefn(10 * \i)}, #2) --
			({#1 + \abscalefn(10 * \i)}, #2 + 0.3)
			node[above] {\ifthenelse{\i=10}{1}{\i}};
	}

	% Submarks 1 - 9
	\foreach \n in {1, ..., 9} {
		\ifthenelse{\n&lt;5}{
			\foreach \i in {1,..., 9}
		} {
			\foreach \i in {2,4,6,8}
		}
		{
			\ifthenelse{\i=5}{
				\draw[black]
					({#1 + \abscalefn(\n + \i / 10)}, #2) --
					({#1 + \abscalefn(\n + \i / 10)}, #2 + 0.2);
			} {
				\draw[black]
					({#1 + \abscalefn(\n + \i / 10)}, #2) --
					({#1 + \abscalefn(\n + \i / 10)}, #2 + 0.1);
			}
		}
	}

	% Submarks 10 - 100
	\foreach \n in {10,20,...,90} {
		\ifthenelse{\n&lt;50}{
			\foreach \i in {1,..., 9}
		} {
			\foreach \i in {2,4,6,8}
		}
		{
			\ifthenelse{\i=5}{
				\draw[black]
					({#1 + \abscalefn(\n + \i)}, #2) --
					({#1 + \abscalefn(\n + \i)}, #2 + 0.2);
			} {
				\draw[black]
					({#1 + \abscalefn(\n + \i)}, #2) --
					({#1 + \abscalefn(\n + \i)}, #2 + 0.1);
			}
		}
	}
}

\newcommand{\cdscale}[3]{
	\draw[black] ({#1}, #2) -- ({#1 + \sliderulewidth}, #2);
	\draw[black] ({#1}, #2 + 0.9) -- ({#1 + \sliderulewidth}, #2 + 0.9);
	\draw[black] ({#1}, #2 + 0.9) -- ({#1}, #2 + 0.7);
	\draw[black] ({#1 + \sliderulewidth}, #2 + 0.9) -- ({#1 + \sliderulewidth}, #2 + 0.7);


	\draw ({#1 - 0.1}, #2 + 0.5) node[left] {#3};

	% Numbers and marks 1 - 10
	\foreach \i in {1,..., 10}{
		\draw[black]
			({#1 + \cdscalefn(\i)}, #2) --
			({#1 + \cdscalefn(\i)}, #2 + 0.3)
			node[above] {\ifthenelse{\i=10}{1}{\i}};
	}

	% Submarks 1 - 9
	\foreach \n in {1, ..., 9} {
		\ifthenelse{\n&lt;3}{
			\foreach \i in {5,10,...,95}
		} {
			\foreach \i in {10,20,...,90}
		}
		{
			\ifthenelse{\i=50}{
				\draw[black]
					({#1 + \cdscalefn(\n + \i / 100)}, #2) --
					({#1 + \cdscalefn(\n + \i / 100)}, #2 + 0.2);
				\ifthenelse{\n=1}{
					\draw
						({#1 + \cdscalefn(\n + \i / 100)}, #2 + 0.2)
						node [above] {1.5};
				}{}
			} {
				\ifthenelse{
					\i=10 \OR \i=20 \OR \i=30 \OR \i=40 \OR
					\i=60 \OR \i=70 \OR \i=80 \OR \i=90
				}{
					\draw[black]
						({#1 + \cdscalefn(\n + \i / 100)}, #2) --
						({#1 + \cdscalefn(\n + \i / 100)}, #2 + 0.15);
				} {
					\draw[black]
						({#1 + \cdscalefn(\n + \i / 100)}, #2) --
						({#1 + \cdscalefn(\n + \i / 100)}, #2 + 0.1);
				}
			}
		}
	}
}

\newcommand{\ciscale}[3]{
	\draw[black] ({#1}, #2) -- ({#1 + \sliderulewidth}, #2);
	\draw[black] ({#1}, #2 + 0.9) -- ({#1 + \sliderulewidth}, #2 + 0.9);
	\draw[black] ({#1}, #2 + 0.9) -- ({#1}, #2 + 0.7);
	\draw[black] ({#1 + \sliderulewidth}, #2 + 0.9) -- ({#1 + \sliderulewidth}, #2 + 0.7);


	\draw ({#1 - 0.1}, #2 + 0.5) node[left] {#3};

	% Numbers and marks
	\foreach \i in {1,...,10}{
		\draw[black]
			({#1 + \ciscalefn(\i)}, #2) --
			({#1 + \ciscalefn(\i)}, #2 + 0.3)
			node[above] {\ifthenelse{\i=10}{1}{\ifthenelse{\i=0}{0}{.\i}}};
	}

	% Submarks 1 - 9
	\foreach \n in {1, ..., 9} {
		\ifthenelse{\n&lt;3}{
			\foreach \i in {5,10,...,95}
		} {
			\foreach \i in {10,20,...,90}
		}
		{
			\ifthenelse{\i=50}{
				\draw[black]
					({#1 + \ciscalefn(\n + \i / 100)}, #2) --
					({#1 + \ciscalefn(\n + \i / 100)}, #2 + 0.2);
				\ifthenelse{\n=1}{
					\draw
						({#1 + \ciscalefn(\n + \i / 100)}, #2 + 0.2)
						node [above] {1.5};
				}{}
			} {
				\ifthenelse{
					\i=10 \OR \i=20 \OR \i=30 \OR \i=40 \OR
					\i=60 \OR \i=70 \OR \i=80 \OR \i=90
				}{
					\draw[black]
						({#1 + \ciscalefn(\n + \i / 100)}, #2) --
						({#1 + \ciscalefn(\n + \i / 100)}, #2 + 0.15);
				} {
					\draw[black]
						({#1 + \ciscalefn(\n + \i / 100)}, #2) --
						({#1 + \ciscalefn(\n + \i / 100)}, #2 + 0.1);
				}
			}
		}
	}
}

\newcommand{\kscale}[3]{
	\draw[black] ({#1}, #2) -- ({#1 + \sliderulewidth}, #2);
	\draw[black] ({#1}, #2 + 0.9) -- ({#1 + \sliderulewidth}, #2 + 0.9);
	\draw[black] ({#1}, #2 + 0.9) -- ({#1}, #2 + 0.7);
	\draw[black] ({#1 + \sliderulewidth}, #2 + 0.9) -- ({#1 + \sliderulewidth}, #2 + 0.7);


	\draw ({#1 - 0.1}, #2 + 0.5) node[left] {#3};

	% Numbers and marks 1 - 9
	\foreach \i in {1,...,9}{
		\draw[black]
			({#1 + \kscalefn(\i)}, #2) --
			({#1 + \kscalefn(\i)}, #2 + 0.3)
			node[above] {\i};
	}
	% Numbers and marks 10 - 90
	\foreach \i in {1,..., 9}{
		\draw[black]
			({#1 + \kscalefn(10 * \i)}, #2) --
			({#1 + \kscalefn(10 * \i)}, #2 + 0.3)
			node[above] {\ifthenelse{\i=10}{1}{\i}};
	}
	% Numbers and marks 100 - 1000
	\foreach \i in {1,..., 10}{
		\draw[black]
			({#1 + \kscalefn(100 * \i)}, #2) --
			({#1 + \kscalefn(100 * \i)}, #2 + 0.3)
			node[above] {\ifthenelse{\i=10}{1}{\i}};
	}

	% Submarks 1 - 9
	\foreach \n in {1, ..., 9} {
		\ifthenelse{\n&lt;4}{
			\foreach \i in {1,..., 9}
		} {
			\foreach \i in {2,4,6,8}
		}
		{
			\ifthenelse{\i=5}{
				\draw[black]
					({#1 + \kscalefn(\n + \i / 10)}, #2) --
					({#1 + \kscalefn(\n + \i / 10)}, #2 + 0.2);
			} {
				\draw[black]
					({#1 + \kscalefn(\n + \i / 10)}, #2) --
					({#1 + \kscalefn(\n + \i / 10)}, #2 + 0.1);
			}
		}
	}

	% Submarks 10 - 90
	\foreach \n in {10,20,...,90} {
		\ifthenelse{\n&lt;40}{
			\foreach \i in {1,..., 9}
		} {
			\foreach \i in {2,4,6,8}
		}
		{
			\ifthenelse{\i=5}{
				\draw[black]
					({#1 + \kscalefn(\n + \i)}, #2) --
					({#1 + \kscalefn(\n + \i)}, #2 + 0.2);
			} {
				\draw[black]
					({#1 + \kscalefn(\n + \i)}, #2) --
					({#1 + \kscalefn(\n + \i)}, #2 + 0.1);
			}
		}
	}

	% Submarks 100 - 1000
	\foreach \n in {100,200,...,900} {
		\ifthenelse{\n&lt;400}{
			\foreach \i in {10,20,...,90}
		} {
			\foreach \i in {20,40,60,80}
		}
		{
			\ifthenelse{\i=50}{
				\draw[black]
					({#1 + \kscalefn(\n + \i)}, #2) --
					({#1 + \kscalefn(\n + \i)}, #2 + 0.2);
			} {
				\draw[black]
					({#1 + \kscalefn(\n + \i)}, #2) --
					({#1 + \kscalefn(\n + \i)}, #2 + 0.1);
			}
		}
	}
}

\newcommand{\lscale}[3]{
	\draw[black] ({#1}, #2) -- ({#1 + \sliderulewidth}, #2);
	\draw[black] ({#1}, #2 + 0.9) -- ({#1 + \sliderulewidth}, #2 + 0.9);
	\draw[black] ({#1}, #2 + 0.9) -- ({#1}, #2 + 0.7);
	\draw[black] ({#1 + \sliderulewidth}, #2 + 0.9) -- ({#1 + \sliderulewidth}, #2 + 0.7);


	\draw ({#1 - 0.1}, #2 + 0.5) node[left] {#3};

	% Numbers and marks
	\foreach \i in {0,..., 10}{
		\draw[black]
			({#1 + \lscalefn(\i / 10)}, #2) --
			({#1 + \lscalefn(\i / 10)}, #2 + 0.3)
			node[above] {\ifthenelse{\i=10}{1}{\ifthenelse{\i=0}{0}{.\i}}};
	}

	% Submarks
	\foreach \n in {0, ..., 9} {
		\foreach \i in {1,...,19} {
			\ifthenelse{\i=10}{
				\draw[black]
					({#1 + \lscalefn((\n + (\i / 20))/10)}, #2) --
					({#1 + \lscalefn((\n + (\i / 20))/10)}, #2 + 0.2);
			} {
				\ifthenelse{
					\i=1 \OR \i=3 \OR \i=5 \OR \i=7 \OR
					\i=9 \OR \i=11 \OR \i=13 \OR \i=15 \OR
					\i=17 \OR \i=19
				}{
					\draw[black]
						({#1 + \lscalefn((\n + (\i / 20))/10)}, #2) --
						({#1 + \lscalefn((\n + (\i / 20))/10)}, #2 + 0.1);
				} {
					\draw[black]
						({#1 + \lscalefn((\n + (\i / 20))/10)}, #2) --
						({#1 + \lscalefn((\n + (\i / 20))/10)}, #2 + 0.15);
				}
			}
		}
	}
}

\newcommand{\tscale}[3]{
	\draw[black] ({#1}, #2) -- ({#1 + \sliderulewidth}, #2);
	\draw[black] ({#1}, #2 + 0.9) -- ({#1 + \sliderulewidth}, #2 + 0.9);
	\draw[black] ({#1}, #2 + 0.9) -- ({#1}, #2 + 0.7);
	\draw[black] ({#1 + \sliderulewidth}, #2 + 0.9) -- ({#1 + \sliderulewidth}, #2 + 0.7);

	% First line
	\draw[black] ({#1}, #2) -- ({#1}, #2 + 0.2);


	\draw ({#1 - 0.1}, #2 + 0.5) node[left] {#3};

	% Numbers and marks 6 - 10
	\foreach \i in {6,...,9,10,15,...,45}{
		\draw[black]
			({#1 + \tscalefn(\i)}, #2) --
			({#1 + \tscalefn(\i)}, #2 + 0.3)
			node[above] {\i};
	}

	% Submarks 6 - 10
	\foreach \n in {6, ..., 9} {
		\foreach \i in {1,...,9}{
			\ifthenelse{\i=5}{
				\draw[black]
					({#1 + \tscalefn(\n + \i / 10)}, #2) --
					({#1 + \tscalefn(\n + \i / 10)}, #2 + 0.2);
			} {
				\draw[black]
					({#1 + \tscalefn(\n + \i / 10)}, #2) --
					({#1 + \tscalefn(\n + \i / 10)}, #2 + 0.1);
			}
		}
	}

	% Submarks 15 - 45
	\foreach \n in {10, 15, ..., 40} {
		\foreach \i in {1,...,24}{
			\ifthenelse{
				\i=5 \OR \i=10 \OR \i=15 \OR \i=20
			} {
				\draw[black]
					({#1 + \tscalefn(\n + \i / 5)}, #2) --
					({#1 + \tscalefn(\n + \i / 5)}, #2 + 0.2);
			} {
				\draw[black]
					({#1 + \tscalefn(\n + \i / 5)}, #2) --
					({#1 + \tscalefn(\n + \i / 5)}, #2 + 0.1);
			}
		}
	}
}

\newcommand{\sscale}[3]{
	\draw[black] ({#1}, #2) -- ({#1 + \sliderulewidth}, #2);
	\draw[black] ({#1}, #2 + 0.9) -- ({#1 + \sliderulewidth}, #2 + 0.9);
	\draw[black] ({#1}, #2 + 0.9) -- ({#1}, #2 + 0.7);
	\draw[black] ({#1 + \sliderulewidth}, #2 + 0.9) -- ({#1 + \sliderulewidth}, #2 + 0.7);

	% First line
	\draw[black] ({#1}, #2) -- ({#1}, #2 + 0.2);


	\draw ({#1 - 0.1}, #2 + 0.5) node[left] {#3};

	% Numbers and marks
	\foreach \i in {6,...,9,10,15,...,30,40,50,...,60,90}{
		\draw[black]
			({#1 + \sscalefn(\i)}, #2) --
			({#1 + \sscalefn(\i)}, #2 + 0.3)
			node[above] {\i};
	}

	% Submarks 6 - 10
	\foreach \n in {6, ..., 9} {
		\foreach \i in {1,...,9}{
			\ifthenelse{\i=5}{
				\draw[black]
					({#1 + \sscalefn(\n + \i / 10)}, #2) --
					({#1 + \sscalefn(\n + \i / 10)}, #2 + 0.2);
			} {
				\draw[black]
					({#1 + \sscalefn(\n + \i / 10)}, #2) --
					({#1 + \sscalefn(\n + \i / 10)}, #2 + 0.1);
			}
		}
	}

	% Submarks 15 - 30
	\foreach \n in {10, 15, ..., 25} {
		\foreach \i in {1,...,24}{
			\ifthenelse{
				\i=5 \OR \i=10 \OR \i=15 \OR \i=20
			} {
				\draw[black]
					({#1 + \sscalefn(\n + \i / 5)}, #2) --
					({#1 + \sscalefn(\n + \i / 5)}, #2 + 0.2);
			} {
				\draw[black]
					({#1 + \sscalefn(\n + \i / 5)}, #2) --
					({#1 + \sscalefn(\n + \i / 5)}, #2 + 0.1);
			}
		}
	}

	% Submarks 30
	\foreach \n in {30} {
		\foreach \i in {1,...,19}{
			\ifthenelse{
				\i=2 \OR \i=4 \OR \i=6 \OR \i=8 \OR
				\i=10 \OR \i=12 \OR \i=14 \OR \i=16 \OR
				\i=18
			} {
				\draw[black]
					({#1 + \sscalefn(\n + \i / 2)}, #2) --
					({#1 + \sscalefn(\n + \i / 2)}, #2 + 0.2);
			} {
				\draw[black]
					({#1 + \sscalefn(\n + \i / 2)}, #2) --
					({#1 + \sscalefn(\n + \i / 2)}, #2 + 0.1);
			}
		}
	}

	% Submarks 40 - 50
	\foreach \n in {40, 50} {
		\foreach \i in {1,...,9}{
			\ifthenelse{
				\i=5 \OR \i=10 \OR \i=15 \OR \i=20
			} {
				\draw[black]
					({#1 + \sscalefn(\n + \i)}, #2) --
					({#1 + \sscalefn(\n + \i)}, #2 + 0.2);
			} {
				\draw[black]
					({#1 + \sscalefn(\n + \i)}, #2) --
					({#1 + \sscalefn(\n + \i)}, #2 + 0.1);
			}
		}
	}

	% Submarks 60
	\foreach \i in {1,...,10}{
		\ifthenelse{
			\i=5 \OR \i=10
		} {
			\draw[black]
				({#1 + \sscalefn(60 + \i * 2)}, #2) --
				({#1 + \sscalefn(60 + \i * 2)}, #2 + 0.2);
		} {
			\draw[black]
				({#1 + \sscalefn(60 + \i * 2)}, #2) --
				({#1 + \sscalefn(60 + \i * 2)}, #2 + 0.1);
		}
	}
}
</pre></body></html>