[Tex/LaTex] Underline inside of enumerate and align

#enumerateequationsmath-modesyntaxunderline

MAIN QUESTION! This is my first question on here so bear with me. I would like to underline my last line of code where it says underline. I have tried to do so as you can see below, but I keep getting an error. I have looked at other posts, but they do not work for my situation as the users are not inside of enumerate or aligned.

For a bonus, I would also like to do the following

1 Align all numbers, operators, variables, andd insert blank spaces for variables not displayed. As shown in the second image below.

2 I would like to have the word solution and the following equations closer to the left because they appear too far to the right.

3 I would like to have a column for each question and/or answer similar to the format shown in the second image below.

4 I would also like to know how I can bring the word solution down without needing to put so many backslashes as shown below.

5 I cannot get the hyphen to appear where it shows exercises 1-4 when I compile my code.

Please note that I am a code minimalist as you can see, aha! So, if it is possible to code in the desired format using a small amount of code that would be much appreciated.

CODE FOR MAIN QUESTION

    \begin{document}
    \begin{enumerate}
    \item
    $
    \begin{aligned}[t]
      x_1+5x_2&= 7 \\ 
    -2x_1-7x_2&=-5 \\
    \end{aligned} \\\\\\
    \textbf{Solution:} \\\\
    \begin{aligned}[t]
      x_1+5x_2&=7  \\
    -2x_1-7x_2&=-5 \\\\
    2(x_1 +5x_2&=7) & \text{Replacement Eq. 2}\\
    \underline{+-2x_1-7x_2&=-5}
    \end{aligned}
    $
    \end{enumerate}
    \end{document}

IMAGE FOR ALL QUESTIONS EXCEPT Q1 & Q3

IMAGE FOR Q1 & Q3

Best Answer

  • please one problem per question ...
  • your mwe is not complete and it produce different result from your illustration of problem
  • main problem can be solved by use of \array instead of the aligned math environment

enter image description here

\documentclass{article}
\usepackage{amsmath}
\setlength\arraycolsep{1pt}

\begin{document}
\begin{enumerate}
\item
$
\begin{array}[t]{rl}
  x_1+5x_2&= 7 \\   \hline
-2x_1-7x_2&=-5 \\   \hline
\end{array}
$

\bigskip
\textbf{Solution:}
$
\begin{array}[t]{rll}
  x_1+5x_2  &=7  &  \\
-2x_1-7x_2  &=-5 &  \\
2(x_1 +5x_2 &=7) & \qquad\text{Replacement Eq. 2}\\
\pm 2x_1-7x_2&=-5 &    \\   \cline{1-2}
\end{array}
$
\end{enumerate}
\end{document}

edit:

  • array option [t] align array first row with text row where array is placed(without option the vertical center of array is aligned and with option [b] is aligne bottom array row
  • `cline{1-2}˛draw line from start of first column to end of the second column
  • command \pm (plus minus) write symbol + over -
  • i suggest you to read some introductory texts about latex, for example The Not so short Introduction to LaTeX2e or for tables in math as are LaTeX/Tables and LaTeX/Mathematics
Related Question