Underline inside of enumerate and align

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
2
down vote

favorite












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



 begindocument
beginenumerate
item
$
beginaligned[t]
x_1+5x_2&= 7 \
-2x_1-7x_2&=-5 \
endaligned \\\
textbfSolution: \\
beginaligned[t]
x_1+5x_2&=7 \
-2x_1-7x_2&=-5 \\
2(x_1 +5x_2&=7) & textReplacement Eq. 2\
underline+-2x_1-7x_2&=-5
endaligned
$
endenumerate
enddocument


IMAGE FOR ALL QUESTIONS EXCEPT Q1 & Q3



IMAGE FOR Q1 & Q3







share|improve this question


















  • 2




    Welcome to TeX.SE! The issue is not enumerate, nor aligned, but the fact that you want to underline some piece that contains an &. You can solve this issue by saying underline+-2x_1-7x_2&underline=-5vphantomx_1. The vphantom is just there to make sure that the underline is on the same level on both sides of the &.
    – marmot
    Aug 18 at 3:52







  • 2




    Welcome! 1) Follow the suggestions of the marmot, and 2) I like the red-black style :).
    – manooooh
    Aug 18 at 4:06










  • @Bernard Thanks for correcting my silly misspellings. Didn't know people could do that.
    – I. King
    Aug 18 at 19:09






  • 1




    @manooooh thanks! I use overleaf v1 night style. v2 does not havev this style.
    – I. King
    Aug 18 at 19:09










  • As Zarko answered, one problem per question works best on this site. The - disappears because you copy and pasted an en-dash from somewhere else instead of typing - on your keyboard.
    – Teepeemm
    Aug 18 at 23:36














up vote
2
down vote

favorite












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



 begindocument
beginenumerate
item
$
beginaligned[t]
x_1+5x_2&= 7 \
-2x_1-7x_2&=-5 \
endaligned \\\
textbfSolution: \\
beginaligned[t]
x_1+5x_2&=7 \
-2x_1-7x_2&=-5 \\
2(x_1 +5x_2&=7) & textReplacement Eq. 2\
underline+-2x_1-7x_2&=-5
endaligned
$
endenumerate
enddocument


IMAGE FOR ALL QUESTIONS EXCEPT Q1 & Q3



IMAGE FOR Q1 & Q3







share|improve this question


















  • 2




    Welcome to TeX.SE! The issue is not enumerate, nor aligned, but the fact that you want to underline some piece that contains an &. You can solve this issue by saying underline+-2x_1-7x_2&underline=-5vphantomx_1. The vphantom is just there to make sure that the underline is on the same level on both sides of the &.
    – marmot
    Aug 18 at 3:52







  • 2




    Welcome! 1) Follow the suggestions of the marmot, and 2) I like the red-black style :).
    – manooooh
    Aug 18 at 4:06










  • @Bernard Thanks for correcting my silly misspellings. Didn't know people could do that.
    – I. King
    Aug 18 at 19:09






  • 1




    @manooooh thanks! I use overleaf v1 night style. v2 does not havev this style.
    – I. King
    Aug 18 at 19:09










  • As Zarko answered, one problem per question works best on this site. The - disappears because you copy and pasted an en-dash from somewhere else instead of typing - on your keyboard.
    – Teepeemm
    Aug 18 at 23:36












up vote
2
down vote

favorite









up vote
2
down vote

favorite











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



 begindocument
beginenumerate
item
$
beginaligned[t]
x_1+5x_2&= 7 \
-2x_1-7x_2&=-5 \
endaligned \\\
textbfSolution: \\
beginaligned[t]
x_1+5x_2&=7 \
-2x_1-7x_2&=-5 \\
2(x_1 +5x_2&=7) & textReplacement Eq. 2\
underline+-2x_1-7x_2&=-5
endaligned
$
endenumerate
enddocument


IMAGE FOR ALL QUESTIONS EXCEPT Q1 & Q3



IMAGE FOR Q1 & Q3







share|improve this question














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



 begindocument
beginenumerate
item
$
beginaligned[t]
x_1+5x_2&= 7 \
-2x_1-7x_2&=-5 \
endaligned \\\
textbfSolution: \\
beginaligned[t]
x_1+5x_2&=7 \
-2x_1-7x_2&=-5 \\
2(x_1 +5x_2&=7) & textReplacement Eq. 2\
underline+-2x_1-7x_2&=-5
endaligned
$
endenumerate
enddocument


IMAGE FOR ALL QUESTIONS EXCEPT Q1 & Q3



IMAGE FOR Q1 & Q3









share|improve this question













share|improve this question




share|improve this question








edited Aug 18 at 8:41









Bernard

155k762188




155k762188










asked Aug 18 at 3:22









I. King

204




204







  • 2




    Welcome to TeX.SE! The issue is not enumerate, nor aligned, but the fact that you want to underline some piece that contains an &. You can solve this issue by saying underline+-2x_1-7x_2&underline=-5vphantomx_1. The vphantom is just there to make sure that the underline is on the same level on both sides of the &.
    – marmot
    Aug 18 at 3:52







  • 2




    Welcome! 1) Follow the suggestions of the marmot, and 2) I like the red-black style :).
    – manooooh
    Aug 18 at 4:06










  • @Bernard Thanks for correcting my silly misspellings. Didn't know people could do that.
    – I. King
    Aug 18 at 19:09






  • 1




    @manooooh thanks! I use overleaf v1 night style. v2 does not havev this style.
    – I. King
    Aug 18 at 19:09










  • As Zarko answered, one problem per question works best on this site. The - disappears because you copy and pasted an en-dash from somewhere else instead of typing - on your keyboard.
    – Teepeemm
    Aug 18 at 23:36












  • 2




    Welcome to TeX.SE! The issue is not enumerate, nor aligned, but the fact that you want to underline some piece that contains an &. You can solve this issue by saying underline+-2x_1-7x_2&underline=-5vphantomx_1. The vphantom is just there to make sure that the underline is on the same level on both sides of the &.
    – marmot
    Aug 18 at 3:52







  • 2




    Welcome! 1) Follow the suggestions of the marmot, and 2) I like the red-black style :).
    – manooooh
    Aug 18 at 4:06










  • @Bernard Thanks for correcting my silly misspellings. Didn't know people could do that.
    – I. King
    Aug 18 at 19:09






  • 1




    @manooooh thanks! I use overleaf v1 night style. v2 does not havev this style.
    – I. King
    Aug 18 at 19:09










  • As Zarko answered, one problem per question works best on this site. The - disappears because you copy and pasted an en-dash from somewhere else instead of typing - on your keyboard.
    – Teepeemm
    Aug 18 at 23:36







2




2




Welcome to TeX.SE! The issue is not enumerate, nor aligned, but the fact that you want to underline some piece that contains an &. You can solve this issue by saying underline+-2x_1-7x_2&underline=-5vphantomx_1. The vphantom is just there to make sure that the underline is on the same level on both sides of the &.
– marmot
Aug 18 at 3:52





Welcome to TeX.SE! The issue is not enumerate, nor aligned, but the fact that you want to underline some piece that contains an &. You can solve this issue by saying underline+-2x_1-7x_2&underline=-5vphantomx_1. The vphantom is just there to make sure that the underline is on the same level on both sides of the &.
– marmot
Aug 18 at 3:52





2




2




Welcome! 1) Follow the suggestions of the marmot, and 2) I like the red-black style :).
– manooooh
Aug 18 at 4:06




Welcome! 1) Follow the suggestions of the marmot, and 2) I like the red-black style :).
– manooooh
Aug 18 at 4:06












@Bernard Thanks for correcting my silly misspellings. Didn't know people could do that.
– I. King
Aug 18 at 19:09




@Bernard Thanks for correcting my silly misspellings. Didn't know people could do that.
– I. King
Aug 18 at 19:09




1




1




@manooooh thanks! I use overleaf v1 night style. v2 does not havev this style.
– I. King
Aug 18 at 19:09




@manooooh thanks! I use overleaf v1 night style. v2 does not havev this style.
– I. King
Aug 18 at 19:09












As Zarko answered, one problem per question works best on this site. The - disappears because you copy and pasted an en-dash from somewhere else instead of typing - on your keyboard.
– Teepeemm
Aug 18 at 23:36




As Zarko answered, one problem per question works best on this site. The - disappears because you copy and pasted an en-dash from somewhere else instead of typing - on your keyboard.
– Teepeemm
Aug 18 at 23:36










1 Answer
1






active

oldest

votes

















up vote
5
down vote



accepted










  • 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



documentclassarticle
usepackageamsmath
setlengtharraycolsep1pt

begindocument
beginenumerate
item
$
beginarray[t]rl
x_1+5x_2&= 7 \ hline
-2x_1-7x_2&=-5 \ hline
endarray
$

bigskip
textbfSolution:
$
beginarray[t]rll
x_1+5x_2 &=7 & \
-2x_1-7x_2 &=-5 & \
2(x_1 +5x_2 &=7) & qquadtextReplacement Eq. 2\
pm 2x_1-7x_2&=-5 & \ cline1-2
endarray
$
endenumerate
enddocument


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

  • `cline1-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





share|improve this answer






















  • Thanks for the quick reply and nice tips for using stack exchange! Since I am fairly new to LaTeX, some of what you have done I did not understand. What is cline, connect line? Also, what is pm? Also, I found [t] online but I do not know what that means. Can you explain it? Thanks again @Zarko
    – I. King
    Aug 18 at 19:21










Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "85"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);








 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f446519%2funderline-inside-of-enumerate-and-align%23new-answer', 'question_page');

);

Post as a guest






























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
5
down vote



accepted










  • 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



documentclassarticle
usepackageamsmath
setlengtharraycolsep1pt

begindocument
beginenumerate
item
$
beginarray[t]rl
x_1+5x_2&= 7 \ hline
-2x_1-7x_2&=-5 \ hline
endarray
$

bigskip
textbfSolution:
$
beginarray[t]rll
x_1+5x_2 &=7 & \
-2x_1-7x_2 &=-5 & \
2(x_1 +5x_2 &=7) & qquadtextReplacement Eq. 2\
pm 2x_1-7x_2&=-5 & \ cline1-2
endarray
$
endenumerate
enddocument


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

  • `cline1-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





share|improve this answer






















  • Thanks for the quick reply and nice tips for using stack exchange! Since I am fairly new to LaTeX, some of what you have done I did not understand. What is cline, connect line? Also, what is pm? Also, I found [t] online but I do not know what that means. Can you explain it? Thanks again @Zarko
    – I. King
    Aug 18 at 19:21














up vote
5
down vote



accepted










  • 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



documentclassarticle
usepackageamsmath
setlengtharraycolsep1pt

begindocument
beginenumerate
item
$
beginarray[t]rl
x_1+5x_2&= 7 \ hline
-2x_1-7x_2&=-5 \ hline
endarray
$

bigskip
textbfSolution:
$
beginarray[t]rll
x_1+5x_2 &=7 & \
-2x_1-7x_2 &=-5 & \
2(x_1 +5x_2 &=7) & qquadtextReplacement Eq. 2\
pm 2x_1-7x_2&=-5 & \ cline1-2
endarray
$
endenumerate
enddocument


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

  • `cline1-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





share|improve this answer






















  • Thanks for the quick reply and nice tips for using stack exchange! Since I am fairly new to LaTeX, some of what you have done I did not understand. What is cline, connect line? Also, what is pm? Also, I found [t] online but I do not know what that means. Can you explain it? Thanks again @Zarko
    – I. King
    Aug 18 at 19:21












up vote
5
down vote



accepted







up vote
5
down vote



accepted






  • 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



documentclassarticle
usepackageamsmath
setlengtharraycolsep1pt

begindocument
beginenumerate
item
$
beginarray[t]rl
x_1+5x_2&= 7 \ hline
-2x_1-7x_2&=-5 \ hline
endarray
$

bigskip
textbfSolution:
$
beginarray[t]rll
x_1+5x_2 &=7 & \
-2x_1-7x_2 &=-5 & \
2(x_1 +5x_2 &=7) & qquadtextReplacement Eq. 2\
pm 2x_1-7x_2&=-5 & \ cline1-2
endarray
$
endenumerate
enddocument


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

  • `cline1-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





share|improve this 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



documentclassarticle
usepackageamsmath
setlengtharraycolsep1pt

begindocument
beginenumerate
item
$
beginarray[t]rl
x_1+5x_2&= 7 \ hline
-2x_1-7x_2&=-5 \ hline
endarray
$

bigskip
textbfSolution:
$
beginarray[t]rll
x_1+5x_2 &=7 & \
-2x_1-7x_2 &=-5 & \
2(x_1 +5x_2 &=7) & qquadtextReplacement Eq. 2\
pm 2x_1-7x_2&=-5 & \ cline1-2
endarray
$
endenumerate
enddocument


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

  • `cline1-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






share|improve this answer














share|improve this answer



share|improve this answer








edited Aug 18 at 19:40

























answered Aug 18 at 4:13









Zarko

111k861148




111k861148











  • Thanks for the quick reply and nice tips for using stack exchange! Since I am fairly new to LaTeX, some of what you have done I did not understand. What is cline, connect line? Also, what is pm? Also, I found [t] online but I do not know what that means. Can you explain it? Thanks again @Zarko
    – I. King
    Aug 18 at 19:21
















  • Thanks for the quick reply and nice tips for using stack exchange! Since I am fairly new to LaTeX, some of what you have done I did not understand. What is cline, connect line? Also, what is pm? Also, I found [t] online but I do not know what that means. Can you explain it? Thanks again @Zarko
    – I. King
    Aug 18 at 19:21















Thanks for the quick reply and nice tips for using stack exchange! Since I am fairly new to LaTeX, some of what you have done I did not understand. What is cline, connect line? Also, what is pm? Also, I found [t] online but I do not know what that means. Can you explain it? Thanks again @Zarko
– I. King
Aug 18 at 19:21




Thanks for the quick reply and nice tips for using stack exchange! Since I am fairly new to LaTeX, some of what you have done I did not understand. What is cline, connect line? Also, what is pm? Also, I found [t] online but I do not know what that means. Can you explain it? Thanks again @Zarko
– I. King
Aug 18 at 19:21












 

draft saved


draft discarded


























 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f446519%2funderline-inside-of-enumerate-and-align%23new-answer', 'question_page');

);

Post as a guest













































































這個網誌中的熱門文章

How to combine Bézier curves to a surface?

Mutual Information Always Non-negative

Why am i infinitely getting the same tweet with the Twitter Search API?