LaTeX forum ⇒ Math & Science ⇒ Sentence in Equation

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
hafizur
Posts: 14
Joined: Sun Nov 22, 2015 11:45 pm

Sentence in Equation

Eq(1)=> Daily average load =No. of units (kWh) generated in a day/24 hours

Eq(2)=> E=mC^2

where E=Energy
m=mass
C= velocity of light

How can I write this above two equations in this template and if length of a sentence is long then what to do?
Last edited by hafizur on Mon Feb 08, 2016 11:23 am, edited 1 time in total.

Johannes_B
Site Moderator
Posts: 4165
Joined: Thu Nov 01, 2012 4:08 pm
One proposal since i don't understand the question:
\documentclass{article}\usepackage{mathtools}\usepackage{array}\begin{document}\begin{align}	\mathrm{Daily~average~load~}&=\mathrm{No.~of~units~(kWh)~	generated~in~a~day/24~hours}\\E&=mC^2\end{align}where  \begin{tabular}[t]{>{$}l<{$}@{~=~}l}E&Energy\\m&mass\\C& velocity of light\end{tabular}\end{document}
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

Stefan Kottwitz
Posts: 9573
Joined: Mon Mar 10, 2008 9:44 pm
Here is another example showing the use of siunitx. It may look strange here, but in bigger documents it's very useful for consistent scientific units and constants.

\documentclass{article}\usepackage{mathtools}\usepackage{siunitx}\DeclareSIUnit\E{E}\DeclareSIUnit\c{c}\begin{document}\begin{equation}   \text{Daily average load} =     \text{No. of units (\si{\kWh}) generated in a day / 24 hours}\end{equation}\begin{equation}   \si{\E} = \si{\m\c\squared}\end{equation}\end{document}

For the rest, see Johannes' post.

Stefan

hafizur
Posts: 14
Joined: Sun Nov 22, 2015 11:45 pm
Thank you very much...

Johannes_B
Site Moderator
Posts: 4165
Joined: Thu Nov 01, 2012 4:08 pm
Stefan,
i would argue that Energy, mass and speed of light have units to measure them, but are not units themselve. Einsteins formula looks really queer written as SI units.

Another thing i came around a while ago was that using \text isn't always a good idea. If that equation is used in a theorem with italic text, the text in the formula will also be written in italics, which would be inconsistent.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

Stefan Kottwitz
Posts: 9573
Joined: Mon Mar 10, 2008 9:44 pm
By the way, you may notice that I wrote constants and units upright. That's what siunitx does, furthermore it takes care of spacing between numbers and units, and more.

Johannes is right, that E and m are variables, but c is a constant, to be written upright, and a mix would look even more strange... so I took the freedom to define them kind of symbolic upshape because we don't really calculate with those variables, or do we ...

640px-Relativity3_Walk_of_Ideas_Berlin.JPG (52.71 KiB) Viewed 6033 times

The photo is by Lienhard Schulz - Own work, CC BY 2.5, https://commons.wikimedia.org/w/index.php?curid=795152.

Stefan

hafizur
Posts: 14
Joined: Sun Nov 22, 2015 11:45 pm
where  \begin{tabular}[t]{>{$}l<{$}@{~=~}l}x&Measurement interval (1 hour). The value of x can be up to 8760 in a year, if the plant operates throughout. In case the plant has been shut down for some period in year y, in that year, use the number of measurement for x for the operational hour only\\\end{tabular}

Here the description length of x is very long, this text cross the right side border in pdf and no starting in new line after first line. This sentence always in one line. How can I solve this?
Last edited by hafizur on Mon Feb 08, 2016 4:11 pm, edited 1 time in total.

Johannes_B
Site Moderator
Posts: 4165
Joined: Thu Nov 01, 2012 4:08 pm
Substitute the final l (ell) when defining the columns with p{.8\linewidth}.

I recommend to read LaTeX for complete novices.

On the other hand, i think that in a sserious paper, the description of what a variable or constant is, belongs into the text. In text, the meaning can be written in clear sentences. A proper list of symbols at the begin or end of a paper with a short description for a quick look-up is the usal way to go.
Having the description glued to the equation is one of the most hideous things i see in academic papers and technical reports.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

hafizur
Posts: 14
Joined: Sun Nov 22, 2015 11:45 pm
Thank you.