i am trying to write some equation with numbering in table like this one
and this is my code
\begin{table}[]
\centering
\begin{tabular}{@{}ll@{}}
\toprule
Performance measure & Definition \\ \midrule
energy & \begin{equation}
E_{(AC,D)}=\sum_{t=1}^{24}E_{AC,t}
E_{(AC,m)}=\sum_{d=1}^{N}E_{AC,d}
\label{eq:Bsp_OhmsLaw}
\end{equation} \\
Reference yield &\begin{equation} Y_{(R)}=\frac{H_{t}(kWh/m^2)}{G(kW/m^2)}
\end{equation}\\
\noindent
Array yield & \begin{equation} Y_{(A,d)}=\frac{E_{DC,d}}{P_{pv,rated}} ,Y_{(A,m)}=\frac{1}{N}\sum_{d=1}^{N}{Y_{A,d}} \end{equation} \\
Final yield &\begin{equation} Y_{(F,d)}=\frac{E_{AC,d}}{P_{pv,rated}} ,Y_{(F,m)}=\frac{1}{N}\sum_{d=1}^{N}{Y_{F,d}} \end{equation}\\
Performance ratio &\begin{equation} PR=\frac{Y_{F}}{Y_{R}}
\end{equation} \\
System losses & \begin{equation}L_{S}=Y_{A}-Y_{F}\end{equation} \\
Array capture losses &\begin{equation} L_{c}=Y_{R}-Y_{A}\end{equation} \\
Array efficiency &\begin{equation} eta_{(PV)}=\frac{P_{DC}}{H_{t}*A_{m}}\end{equation} \\
System efficiency &\begin{equation} \eta_{(sys)}=\frac{P_{AC}}{H_{t}*A_{m}} \end{equation} \\
Inverter efficiency & \begin{equation}\frac{P_{AC}}{P_{DC}} \end{equation}\\ \bottomrule
\end{tabular}
\end{table}
and i get this result with many error
thank you very much.i really need this table
Best Answer
First, the reason why your code does not compile is that you cannot have an
equation
environment inside a table, which is not allowed. You could put each equation inside the table as inline mathematics using$...$
and you can force the equations to be in display mode, as they would be inside\begin{equation}...\end{equation}
, by using$\displaystyle ...$
.As I think that each equation should have an associated reference, the nicest way to do this is to define two new column types using the
\newcolumntype
command from the array package:With these in place the
M
-type columns are put into display stye and theL
-type columns will have an equation number and the contents of the last table cell become a reference to this equation. To define theL
-type columns we need to use the collcell to extract the contents of the so that we can use them with the\label
command, which is done by\AddLabel
. The\AddLabel
command also increments and prints the equation number.For example, one of the entries in the table will be:
With this in place the resulting table looks like:
Here is the full code:
Notice that
tabular
environment with a full widthtabularx
environment using the tabularx packageP_{pv,rated}
with a macro\PV
. The most important part of the macro is that it replaces this with\P_{\text{pv,rated}}
so that "rated" is typeset as a word instead of the product of the variablesr
,a
,t
,e
andd
. You should probably do the same elsewhere such as withP_{\text{AC}}
andP_{\text{DC}}
\displaystyle
from the\AddLabel
macro\multicolumn
for the second and third columns in the table header in order to "turn off" the special processing for theL
andM
type columnseta
to\eta
in equation (8)X
-type column so that they take all available space. The definition of theM
-type has two\hfil
commands so that the equations are centered within the columnAs suggested by @Zarko I have used the siunitx package for the units in equation (2) and I have used the makecell package to make the spacing of the different formulas more consistent
+1 for using booktabs!