TransWikia.com

Array size of things

TeX - LaTeX Asked by J.Rodriguez on December 16, 2020

I have the following code:

documentclass[12pt]{article}
usepackage{mathtools}
begin{document}
    $$  begin{array}{cl}
        f(hat{x}_n) & =displaystyle  int_{-1}^{0} hat{x}_n d t  - int_{0}^{1} hat{x}_n d t  
         & = displaystyle  int_{-1}^{-frac{1}{n+1}} d t   +int_{-frac{1}{n+1}}^{0} -(n+1)t d t   +int_{0}^{frac{1}{n+1}} (n+1)t d t  +int_{frac{1}{n+1}}^{1} d t 
         & =frac{n}{n+1} +frac{n}{2n+21} +frac{n}{2n+2}  +frac{n}{n+1} 
         & = frac{2n+1}{n+1} 
    end{array}
    $$
end{document}

This gave me the following:
enter image description here

And this very ugly, the size of the fractions is too small, if I change it they overlapse, the same space of the lines is very small for the integrals to look good. How can I improve this?

One Answer

With align for numbered lines and align* for unnumbered lines:

enter image description here

documentclass[12pt]{article}
usepackage{mathtools}
begin{document}
begin{align}
 f(hat{x}_n) & = int_{-1}^{0} hat{x}_n d t  - int_{0}^{1} hat{x}_n d t  
              & = int_{-1}^{-frac{1}{n+1}} d t   +int_{-frac{1}{n+1}}^{0} -(n+1)t d t   
                  +int_{0}^{frac{1}{n+1}} (n+1)t d t  +int_{frac{1}{n+1}}^{1} d t 
              & =frac{n}{n+1} +frac{n}{2n+21} +frac{n}{2n+2}  +frac{n}{n+1} 
              & = frac{2n+1}{n+1} 
end{align}


begin{align*}
 f(hat{x}_n) & = int_{-1}^{0} hat{x}_n d t  - int_{0}^{1} hat{x}_n d t  
              & = int_{-1}^{-frac{1}{n+1}} d t   +int_{-frac{1}{n+1}}^{0} -(n+1)t d t   
                  +int_{0}^{frac{1}{n+1}} (n+1)t d t  +int_{frac{1}{n+1}}^{1} d t 
              & =frac{n}{n+1} +frac{n}{2n+21} +frac{n}{2n+2}  +frac{n}{n+1} 
              & = frac{2n+1}{n+1} 
end{align*}
end{document}

Answered by leandriis on December 16, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP