0

I looked for a command to improve the equation item and I met this one.

\usepackage{amsmath}
newcommand{\itemEq}[1]{%
         \begingroup%
         \setlength{\abovedisplayskip}{0pt}%
         \setlength{\belowdisplayskip}{0pt}%
         \parbox[c]{\linewidth}{\begin{flalign}#1&&\end{flalign}}%
         \endgroup}

working with the command I noticed that it has problems recalling the foonotes but also with the format of the text, such as in this case:

\begin{itemize}

\item[d)]\itemEq{\Dtot{\ui}{t}=\Dpar{\ui}{t}+\sum_{j=1}^{3}\Dpar{\ui}{x_j}\uj = \uit+\ui\cdot\uij:\text{Derivata Lagrangiana  della componente i-esima della velocità}}  

\end{itemize}

the text is very long and I can not go to the next line

enter image description here

-----------------------UPDATE---------------------------

I found the solution :

\item[d)]\itemEq{\Dtot{\ui}{t}=\Dpar{\ui}{t}+\sum_{j=1}^{3}\Dpar{\ui}{x_j}\uj = \uit+\ui\cdot\uij:\text{\parbox{5cm}{Derivata Lagrangiana  della componente i-esima della velocità}}}  

enter image description here

  • Do you need an equation number? – Bernard Nov 7 '18 at 21:00
  • @Bernard I would like to divide the text into two lines – Antonio Nov 7 '18 at 21:04
  • That is easy, but why do you use the flalign environment? – Bernard Nov 7 '18 at 21:16
  • @Bernard Because it seemed appropriate. but I do not think so. – Antonio Nov 7 '18 at 21:32
  • What so you try to achieve? An equation in \displaystyle, and some explanation afterwards, beginning on the same line? – Bernard Nov 7 '18 at 21:47
1

You can measure the equation and set the text in the remaining space with some clearance. But my preference would be to state the description and then display the equation.

\documentclass[a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[italian]{babel}
\usepackage{amsmath}
\usepackage{enumitem}

\newsavebox{\eqdescbox}

\newcommand{\eqdesc}[2]{%
  \sbox{\eqdescbox}{$\displaystyle #1$}%
  \usebox{\eqdescbox}\hfill
  \parbox[t]{\dimexpr\linewidth-2em-\wd\eqdescbox}{\raggedright #2}%
}

\newcommand{\Dtot}[2]{\frac{D#1}{D#2}}
\newcommand{\Dpar}[2]{\frac{\partial#1}{\partial#2}}

\begin{document}

\begin{enumerate}[label=\alph*)]

\item \eqdesc{
  \Dtot{u_i}{t}=\Dpar{u_i}{t}+\sum_{j=1}^{3}\Dpar{u_i}{x_j}u_j =
  u_it+u_i\cdot u_{ij}
}{Derivata Lagrangiana  della componente $i$-esima della velocità}

\item Derivata Lagrangiana  della componente $i$-esima della velocità
\begin{equation*}
  \Dtot{u_i}{t}=\Dpar{u_i}{t}+\sum_{j=1}^{3}\Dpar{u_i}{x_j}u_j =
  u_it+u_i\cdot u_{ij}
\end{equation*}

\end{enumerate}

\end{document}

I don't think you gain too much by typing \ui over u_i: it's error prone and forces you to remember too many commands.

enter image description here

| improve this answer | |
  • I have a problem of displaying the braces and with the subscript: u_i, u_ i, ij, i, u_ {j, ij} ... etc. etc. I was forced to write the synthetic commands, equations. In TeXStudio I did not find a way to have a different color in the brackets, I often find the code boring. – Antonio Nov 8 '18 at 7:01
2

I can propose this, based on tabularx. Not having your macros, I loaded the diffcoeff package to simplify typing of derivatives.

\documentclass[italian]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{ragged2e}
\usepackage[showframe]{geometry}
\usepackage{amsmath, diffcoeff}
\usepackage{enumitem}
\usepackage{tabularx}

\begin{document}

\begin{enumerate}[label=\alph*), start=4]
\item
\begin{tabularx}{\linewidth}{>{$\displaystyle}c<{$}>{\RaggedRight\arraybackslash}X@{}|}
\Diff{u_i}{t}=\diffp{u_i}{t}+∑_{j=1}^{3}\diffp{u_i}{x_j}u_j = u_{i, t} +u_i \cdot u_{i, j} :
& Derivata Lagrangiana della componente i-esima della velocità.
\end{tabularx}
\end{enumerate}

\end{document} 

enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.