0

I have this array:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath, amsfonts}
\usepackage[thicklines]{cancel}

\title{shortenedExample} \author{CATboardBETA} \date{February 2022}

\DeclareMathSymbol{\shortminus}{\mathbin}{AMSa}{"39}

\begin{document}

\Huge \begin{equation} \begin{array}{rcccccccc} & 45 & = & \overbrace{3x}^{\text{small}} & + & \overbrace{5y}^{\text{large}} \[.4em] & 10 & = & x & + & y \ \times & \shortminus3 &&\shortminus3&&\shortminus3 \ \hline & \shortminus30 & = & \shortminus3x & + & \shortminus3y \[1em]

& 45 & = & 3x & + & 5y \

  • & \shortminus30 & = & \shortminus3x & + & \shortminus3y \

\hline & 15 & = & \cancel{0x} & + & 2y \ & 15 & = & 2y \[1em] & 15 & = & 2y \ & 2 && 2 \end{array} \end{equation}

\end{document}

I would like to display an horizontal line between the 15 and 2, and between the 2y and 2, as in a division bar. How can I do this?

I tried just using underlines and the like, but they never looked right.

Simon Dispa
  • 39,141
CATboardBETA
  • 123
  • 7

3 Answers3

2

Use the \cmidrule command of the package booktabs

It has an optional argument using parentheses ( ) to specify on which side it should be reduced in length (l) or (r) or both (lr). Try \cmidrule(l{6pt}r{6pt}){2-2} to shorten both sides by 6pt.

d

\documentclass{article}

\usepackage{cancel} \usepackage{amssymb} \usepackage{amsmath}

\usepackage{booktabs} % added <<<<<<<<<<<<<<<<

%From https://tex.stackexchange.com/a/469724/161015 \DeclareMathSymbol{\shortminus}{\mathbin}{AMSa}{"39}

\begin{document}

$\begin{array}{rccccc} & 45 & = & \overbrace{3x}^{\text{small}} & + & \overbrace{5y}^{\text{large}} \[.4em] & 10 & = & x & + & y \ \times & \shortminus3 & &\shortminus3 & &\shortminus3 \ \hline & \shortminus30 & = & \shortminus3x & + & \shortminus3y \[1em] & 45 & = & 3x & + & 5y \

  •   &amp; \shortminus30 &amp; = &amp; \shortminus3x                 &amp; + &amp; \shortminus3y \\
    

\hline & 15 & = & \cancel{0x} & + & 2y \ & 15 & = & 2y & & \[1em] &15 & & 2y & & \ \cmidrule(lr){2-2}\cmidrule(lr){4-4} % added <<<<<<<<<<<< <<<<<<<<<<<<<<<<<<<<<<<<<<<<< & 2 & = & 2 & & \ % \end{array}$

\end{document}

Simon Dispa
  • 39,141
2

By use of the package tabularrray. You may like :-)

\documentclass{article}
\usepackage{tabularray}
\UseTblrLibrary{amsmath, booktabs}
\usepackage{amssymb}
\usepackage[thicklines]{cancel}

\DeclareMathSymbol{\shortminus}{\mathbin}{AMSa}{"39}

\begin{document}

\Huge [
\begin{tblr}{colspec={rc cc cc}, colsep=3pt, } &45 & = & \overbrace{3x}^{\mathrm{small}} & + & \overbrace{5y}^{\mathrm{large}} \ &10 & = & x & + & y \ \times & \shortminus 3 & &\shortminus3 & &\shortminus 3 \ \hline & \shortminus30 & = & \shortminus 3x & + & \shortminus 3y \ \addlinespace &45 & = &3x & + & 5y \

  • & \shortminus30 & = & \shortminus3x & + & \shortminus 3y \

\hline &15 & = & \cancel{0x} & + & 2y \ &15 & = &2y & & \ \addlinespace
&15 & \SetCell[r=2]{c} = &2y & & \ \cline{2-2}\cline{4-4}
& 2 & & 2 & & \end{tblr} ] \end{document}

enter image description here

JeT
  • 3,020
Zarko
  • 296,517
1

In LaTeX array is implemented similarly to tabular so all the things you can do in a tabular will also work with array. In this case, you'll want to use \cline to get a partial line between rows (I'm assuming you meant horizontal and not vertical:

\begin{array}{rcccccccc}
& 45 & = & \overbrace{3x}^{\text{small}} & + & \overbrace{5y}^{\text{large}} \\[.4em]
& 10 & = & x & + & y \\
\times & \shortminus3 &&\shortminus3&&\shortminus3 \\
\hline
& \shortminus30 & = & \shortminus3x & + & \shortminus3y \\[1em]

& 45 & = & 3x & + & 5y \

  • & \shortminus30 & = & \shortminus3x & + & \shortminus3y \

\hline & 15 & = & \cancel{0x} & + & 2y \ & 15 & = & 2y \[1em] & 15 & = & 2y \cline{2-2}\cline{4-4} % ☜ Here's the change & 2 && 2 \end{array}

That said, you probably want to set this as a fraction:

& \frac{15}{2} & = & \frac{2y}{2}
Don Hosek
  • 14,078