1

I noticed now a space problem with hspace, especially the command:

\newcommand{\Div}[1]{\displaystyle \boldsymbol{\nabla}\hspace{-.1em}\cdot\hspace{-.1em} #1}

enter image description here how could it be solved, keeping the same formalism?

external note :

%<*notes012>  
\footnote{ricordando che se $\Div{u}=0$ allora $\barbII{\tau}=-\textbf{p}\I+2\mu\barbII{e}$}
%</notes012>

L'equazione  costitutiva per fluidi newtoniani \eqref{eq062}, può essere espressa nella sua forma per componenti\loadnote{012}:

\begin{equation}\label{eq063}
\begin{aligned}
    \tau_{ij}=-\textbf{p}\delta_{ij}+2\mu\left( \eij-\Fra{1}{3}e_{kk}\delta_{ij}\right) 
    \text{dove $\delta_{ij}$ = }~\left\{\begin{array}{rcl}
    1&\rightarrow& \text{se i = j;}\\
    0&\rightarrow& \text{se i $\neq$ j};\\
    \end{array}\right.\\
\end{aligned}
\end{equation}

\begin{tikzpicture}[right node/.style={rectangle,draw}]
 node{%
        $\begin{aligned}
            \tikzmarknode{ex1}e_{kk}\tikzmarknode{ex2}=tr(\barbII{e})=\tikzmarknode{ex3}\Div{u}
        \end{aligned}$};

    \draw[->,>=latex]([shift={(-70pt,-5pt)}]pic cs:ex1-ex2) |- ++(80pt,-25pt) node[right,text width=6cm] 
    { Considera la somma degli elementi della diagonale di $\barbII{e}$ e non coinvolge gli elementi ij;};
    \draw[->,>=latex]([shift={(-8pt,-15pt)}]pic cs:ex3) |- ++(16pt,-52pt) node[right,text width=6cm] 
    {Velocità di Deformazione Volumetrica (Comprimibiltà);};
\end{tikzpicture}

the \nabla}\hspace{-.1em}\cdot\hspace{-.1em} has different distances. when it is inserted in the command \begin{tikzpicture}.... the distances are not respected enter image description here

Antonio
  • 543
  • @marmot i know this but my question concerns a \newcomman ......\ nabla \ cdot. .. . why are not the distances kept? – Antonio Nov 04 '18 at 01:37
  • 1
    @Antonio: Can you provide a complete example that compiles? You can remove all the unnecessary stuff like \eij, \Fra, \loadnote, ... since they have nothing to do with the problem. – Werner Nov 04 '18 at 01:52
  • Well, you are nesting tikzpictures, which should be avoided. Then I am not sure if you are using the correct syntax for \tikzmarknode, it is \tikzmarknode{<label>}{<content>}, yet you are using it in the same way as the (old) \tikzmark command. And, as pointed out by @Werner, you do not provide us with the definitions. Please write an MWE, i.e. a document that starts with \documentclass, ends with \end{document}, can be compiled and illustrates the issue. –  Nov 04 '18 at 02:21

2 Answers2

4

I guess you want the negative space in order to reduce the distance between the centered dot and the symbols at both sides.

Using the em unit is wrong to begin with, because it depends on the text font current at the time the formula started. In a tikzpicture the font might be \nullfont for which the em unit corresponds to zero and, in any case, it is not generally predictable.

Beware also of \displaystyle which serves no real purpose for typesetting “nabla+centered dot+variable” and will make damage to the rest of the formula.

My choice would be, loading also the bm package after amsmath (the package provides for a better replacement of \boldsymbol called \bm, but allows \boldsymbol as a synonym for \bm, so your code need not be changed):

\newcommand{\Div}{\bm{\nabla}\!\cdot\!}

The \! command inserts some negative space using “math units”, which are independent on the current text font. There's no need to use an argument; however, \Div u and \Div{u} would do the same.

You should also avoid \textbf in formulas for math symbols: the correct command is \mathbf as this will not be affected by font parameters (shape, for instance) current at the time the formula started out.

By the way, input such as

\text{dove $\delta_{ij}$ = }~\left\{\begin{array}{rcl}
    1&\rightarrow& \text{se i = j;}\\
    0&\rightarrow& \text{se i $\neq$ j};\\

is incorrect under many respects. It should be

\text{dove }\delta_{ij} = 
\begin{cases}
  1 & \text{se $i = j$;} \\
  0 & \text{se $i \neq j$;}
\end{cases}

I've never seen an arrow between the value for the case and the condition; however, this is not the main point. The letters “i” and “j” denote the very same object as in the subscript to \delta, so they must be typeset in the same way, that is, math italic.

As a stylistic remark, the “Kronecker delta” is so widespread a symbol that it should not be explained as part of a more important explanation: this is very distracting. Define the symbol beforehand and use it without explicit mention.

A grammatical note: Velocit\'a typesets an acute accent whereas it should be a grave accent. Thus Velocit\`a. Or, why not exploiting modern operating systems and type Velocità?

egreg
  • 1,121,712
  • yes, the arrow is a formalism that I use in my notes. maybe it's not formally correct. This is my first document written entirely in latex. I'm rewriting some notes from my professor's lectures. – Antonio Nov 04 '18 at 18:51
  • if I insert the bm package with the command you suggested, I receive many errors. many commands have been written to \boldsymbol (I definitely use it erroneously). what I have written up to now everything should be corrected, even the preamble. unfortunately I have no one to help me in this. By doing the many tests I have done, I have certainly created many errors that I can not correct. – Antonio Nov 04 '18 at 19:24
2

This may not be an answer (but given that you do not provide us with some compilable code, this is the best I can do at this point). This version

  • avoids nesting tikzpictures and
  • uses \tikzmarknode in an arguably more appropriate way.

Apart from that, I guessed what your macros are doing. And I removed redundancies (why are you adding aligned here, you were not using it).

\documentclass[fleqn]{article}
\usepackage{amsmath,bbm}
\usepackage{tikz}
\usetikzlibrary{tikzmark}
\newcommand{\Div}[1]{\displaystyle \boldsymbol{\nabla}\!\cdot\! #1}
\newcommand{\eij}[0]{\ensuremath{e_{ij}}}
\newcommand{\Fra}[2]{\frac{#1}{#2}}
\newcommand{\barbII}[1]{\underset{=}{#1}}
\DeclareMathOperator{\tr}{tr}
\begin{document}

\begin{align}
    \tau_{ij}&=-\boldsymbol{p}\delta_{ij}+2\mu\left( \eij-\Fra{1}{3}e_{kk}\delta_{ij}\right) 
    \text{dove $\delta_{ij}$ = }~\begin{cases}
    1&\rightarrow \text{se}~i = j;\\
    0&\rightarrow \text{se}~i\neq j;
    \end{cases}\label{eq063}\\
    \tikzmarknode{ex1}{e_{kk}}&=\tr(\barbII{e})=\Div{\tikzmarknode{ex3}{u}} 
\end{align}
\bigskip\bigskip\bigskip\bigskip
\begin{tikzpicture}[right node/.style={rectangle,draw},overlay,remember picture]
    \draw[-latex]([yshift=-1pt]ex1.south) |- ++(86pt,-25pt) 
    node[right,text width=6cm] (cons)
    { Considera la somma degli elementi della diagonale di $\barbII{e}$ e non coinvolge gli elementi ij;};
    \draw[-latex,preaction={draw,white,ultra thick,-}]([yshift=-1pt]ex3.south) -- ++(0,-60pt) coordinate(aux)
    -- (aux -| cons.west) node[right,text width=6cm] 
    {Velocit\'a di Deformazione Volumetrica (Comprimibilt\'a);};
\end{tikzpicture}

blah blah\footnote{ricordando che se $\Div{u}=0$ allora $\barbII{\tau}=-\boldsymbol{p}
\boldsymbol{I}+2\mu\barbII{e}$} 
\end{document}

enter image description here

enter image description here

  • 1
    my problem was related to the distance between \nabla, \cdot and u. now it works properly. I'm learning to use latex and I find many interesting difficulties. some with the time I'm starting to solve them. others must study the contents and acquire the right mentality – Antonio Nov 04 '18 at 20:10