Arrays with non-inline style formulas in rows in KaTeX
For those who don't use KaTeX, here's an answer that use the alignat
environment of the amsmath
environment.
\documentclass{article}
\usepackage{array,amssymb,mathtools}
\DeclarePairedDelimiter{\floor}{\lfloor}{\rfloor}
\newcommand\ffrac[2]{\floor*{\frac{#1}{#2}}}
\newlength\mylen
\settowidth\mylen{$\displaystyle x-z\ffrac{x}{z}$} % measure width of middle part
\begin{document}
\begin{alignat}{4}
z\in\Bbb{R}^+, &\quad& 0 &\le{}&& x-z\ffrac{x}{z} &{}<{}& z \\[1ex]
&& z\ffrac{x}{z} &\le{}&& \parbox{\mylen}{\centering$x$} &{}<{}& (z+1)\ffrac{x}{z}
\end{alignat}
\end{document}
A variant of @Mico's solution, using the \DeclarePairedDelimiterX
command, from mathtools
:
\documentclass{article}
\usepackage{mathtools}
\usepackage{amssymb}
\DeclarePairedDelimiterX{\ffrac}[2]{\lfloor}{\rfloor}{\frac{#1}{#2}}
\begin{document}
\setcounter{equation}{7}
\begin{alignat}{3}
z\in\Bbb R^+, \qquad 0 &\le x- & & z\ffrac*{x}{z} & & < z \\[3pt]
z\ffrac*{x}{z} &\le & & x & & < (z+1)\ffrac[\bigg]{x}{z}
\end{alignat}
\end{document}
I just found out that KaTeX has the darray
environment that does exactly what I'm asking for.