TeX - LaTeX Asked by Sylvester on December 20, 2020
This is the code that gives me shorter integral symbol
begin{align*}
begin{array}{l}
{a_0} = dfrac{1}{2L}intlimits_{-pi}^{pi} {fleft( x right)dx}
left.
begin{array}{l}
{a_n} = dfrac{1}{L}intlimits_{-L}^{L} {f(x)cos left( {dfrac{npi}{L}x} right)dx}
{b_n} = dfrac{1}{L}intlimits_{ - L}^L {f(x)sin left( {dfrac{npi}{L}x} right)dx}
end{array}
right},n = {1,2,3,...,N}
end{array}
end{align*}
This is the code that gives me a taller integral symbol
[
{a_1} = dfrac{1}{pi }intlimits_{ - pi }^pi
{fleft( x right)cos left( {dfrac{{1cdotpi }}{pi }x} right)} dx
]
Here's a setup that doesn't require you to insert a plethora of dfrac
and limits
directives -- while still getting you the desired, i.e., large integral symbol. As a bonus, it also performs alignment on the =
symbols -- which isn't the case in your code but nevertheless seems desirable from a typographical point of view.
documentclass{article}
usepackage{amsmath} % for 'align*' env.
usepackage{mleftright} mleftright % optional
begin{document}
begin{align*}
a_0 &= frac{1}{2L} int_{-pi}^{pi} f(x),dx
a_n &= frac{1}{L} int_{-L}^{L} f(x)cos
left( frac{npi}{L} x right),dx,
quad n = 1,2,dots,N
b_n &= frac{1}{L} int_{ - L}^L f(x)sin
left( frac{npi}{L} x right),dx,
quad n = 1,2,dots,N
end{align*}
end{document}
Observe how much the input code has been simplified. Take, for instance, the first row, which has been simplified from
{a_0} = dfrac{1}{2L}intlimits_{-pi}^{pi} {fleft( x right)dx}
to
a_0 &= frac{1}{2L} int_{-pi}^{pi} f(x),dx
Streamlined code is not just aesthetically pleasing; it is also a lot easier to maintain and debug.
Correct answer by Mico on December 20, 2020
If you don't touch :-) the math space mkern -247mu
of the code of
[mkern -247mu a_0 = frac{1}{2L}intlimits_{-pi}^{pi} f(x)dx]
you can have (very similar) structure of your initial image. Here I have used mathtools
+ rcases
.
documentclass[a4paper,12pt]{article}
usepackage{mathtools,amssymb}
begin{document}
[
mkern -247mu a_0 = frac{1}{2L}intlimits_{-pi}^{pi} f(x)dx
]
[
begin{rcases}
{a_n} = displaystylefrac{1}{L}intlimits_{-L}^{L} {f(x)cos left({frac{npi}{L}x} right)dx}
{b_n}=displaystyle frac{1}{L}intlimits_{-L}^L {f(x)sin left({frac{npi}{L}x} right)dx}
end{rcases},
n = {1,2,3,...,N}
]
end{document}
Answered by Sebastiano on December 20, 2020
It's not difficult to get display style integrals with the help of drcases
from mathtools
.
More difficult is to maintain alignment between the equals signs, which is quite important in this case.
documentclass{article}
usepackage[intlimits]{amsmath}
usepackage{mathtools}
usepackage{eqparbox}
newcommand{eqmathbox}[3][c]{%
eqmakebox[#2][#1]{$displaystyle#3$}%
}
newcommand{diff}{mathop{}!d}
begin{document}
begin{align*}
& eqmathbox[l]{A}{a_0}
= frac{1}{2L}int_{-pi}^{pi} f(x)diff x
& mathopen{kern-nulldelimiterspace} % space adjustment
begin{drcases}
eqmathbox[l]{A}{a_n}
= frac{1}{L}int_{-L}^{L} f(x)cos left( dfrac{npi}{L}x right)diff x
eqmathbox[l]{A}{b_n}
= frac{1}{L}int_{-L}^{L} f(x)sin left( dfrac{npi}{L}x right)diff x
end{drcases}
,quad n = 1,2,3,dots,N
end{align*}
end{document}
I've made a few adjustments and used eqparbox
in order to make equally sized boxes for the left-hand sides, with left alignment.
The argument {A}
to eqmathbox
should be unique for the boxes that you want equally sized. Other similar alignments must use a different string. Any string of alphanumeric characters can be used.
Note diff
for the differential, so it is automatically spaced from the previous part, which is common usage in mathematical typography. Instead of left
and right
, I'd recommend, for this case, Bigl
and Bigr
: try and spot the tiny, but significant difference.
The mathopen{kern-nulldelimiterspace}
is a dirty trick to avoid misalignment.
Finally, I removed useless braces from your input and also { and
}around
1,2,dots,N`, which I've never seen used in this case.
About intlimits
, I've strong opinion against it, because it makes for very high and deep lines. If you want all integrals to be treated as limits
, use the appropriate option to amsmath
. In general, I'd use limits
just for integrals over paths or multiple integrals over some domain.
I show the output with intlimits
and without it. In the second picture I used Bigl
and Bigr
in place of left
and right
to help you in spotting the different spacing mentioned above.
Anyway, I endorse Mico's opinion that a single align*
environment is best, with no big brace.
Answered by egreg on December 20, 2020
Perhaps the best option is to avoid the brace altogether. If you want one, maybe a somewhat more subtle brace could be nicer so that the attention of the reader remains on the more relevant content. Once you consider such options, you can avoid tuning and just work with an align*
environment.
documentclass{article}
usepackage{amsmath}
usepackage{mleftright}
usepackage{tikz}
usetikzlibrary{decorations.pathreplacing,calligraphy,fit,tikzmark}
mleftright
newcommand{diff}{mathop{}!mathrm{d}}
begin{document}
begin{align*}
a_0 &= dfrac{1}{2L}intlimits_{-pi}^{pi} fleft( x right)diff x
a_n &= tikzmarknode{A}{dfrac{1}{L}intlimits_{-L}^{L} f(x)cos left( dfrac{npi}{L}x
right)diff x}
b_n &= tikzmarknode{B}{dfrac{1}{L}intlimits_{ - L}^L f(x)sin left( dfrac{npi}{L}x
right)diff x}
begin{tikzpicture}[overlay,remember picture]
node[fit=(A)(B),inner ysep=0pt](F){};
draw[thick,decorate,decoration={calligraphic brace}]
(F.north east) -- (F.south east)
node[midway,right=1ex]{$n = {1,2,3,dots,N}$};
end{tikzpicture}
end{align*}
end{document}
Answered by user227987 on December 20, 2020
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP