• Mar 24th 2012, 04:01 AM
vernal

How can I take the space marked?

Attachment 23426

I wrote it:

The arrows
\begin{tikzpicture}[auto,>=stealth']
\node (1) {$$}; \node[right=of 1] (2) {$$};
\draw[to reversed->] (1) -- node {} (2);
\path[use as bounding box] (-1.5,0) rectangle (0,0);
\end{tikzpicture}
and
\begin{tikzpicture}[auto,>=stealth']
\node (1) {$$}; \node[right=of 1] (2) {$$};

\draw[->>] (1) -- node {} (2);
\path[use as bounding box] (-1.5,0) rectangle (0,0);
\end{tikzpicture} denote injective and surjective homomorphisms (monomorphism and epimorphisms), respectively, and $0={1}$ stands for the Lie lgebra of one element.
• Mar 24th 2012, 12:11 PM
emakarov
What do you mean by taking the space: measuring the distance? How to you specify the locations of the red arrows? Since LaTeX did not typeset the red arrow, it obviously cannot calculate the distance between them.
• Mar 24th 2012, 11:37 PM
vernal
Quote:

Originally Posted by emakarov
What do you mean by taking the space: measuring the distance? How to you specify the locations of the red arrows? Since LaTeX did not typeset the red arrow, it obviously cannot calculate the distance between them.

oh,no... i can not speak english well.. sorry...

the latex give me

Attachment 23430

but i don't like space between "arrow" and http://latex.codecogs.com/gif.latex?\rightarrow

(I have shown with red line)

What should I do ?
• Mar 25th 2012, 10:08 AM
emakarov
OK, let's make a list.

The empty space you are talking about is created by the instruction "\path[use as bounding box] (-1.5,0) rectangle (0,0)". As p. 166 of the TikZ 2.10 manual says, the instruction adds a rectangle with length 1.5cm to the previous bounding box, which contains the arrow. To remove the extra space, get rid of this instruction.

It is not necessary to have an empty math formula inside a node: "\node (1) {$$}" is the same thing as "\node (1) {}". The part "node {}" in "\draw[to reversed->] (1) -- node {} (2)" does not make any difference: it just creates an empty node in the middle of the path. The code of the picture can be made rather small, so instead of saying "\begin{tikzpicture} ... \end{tikzpicture}" you can say "\tikz ... ;". It is not necessary to declare nodes (1) and (2) and then draw an arrow between them. The default space between nodes created by "right=of 1" is 1cm (p. 187 of the manual, option "node distance"). Therefore, a similar result can be achieved by Code: \tikz[>=stealth']\draw[to reversed->] (0,0) -- (1,0); The main difference is that now the arrow is located at the baseline level. The reason why the arrow is raised in your version with nodes is that nodes are not empty. Due to the option "inner sep" (p. 175), a node with no text is in fact a rectangle 2/3em by 2/3em by default. You can see this by saying "\node[draw]" instead of just "\node". Thus, in your example the arrow is 1/3em above the baseline. A drawback is that the line is drawn not between the nodes' centers but between the middles of the nodes' sides facing each other. This introduces a 2/3em space before and after the arrow in addition to the regular TeX text spaces. To get rid of this horizontal space, you can say "\node[inner xsep=0pt]". However, it is better to get rid of nodes at all. Saying Code: \tikz[>=stealth']\draw[to reversed->] (0cm,.5ex) -- (1cm,.5ex); or Code: \tikz[>=stealth']\draw[yshift=.5ex,to reversed->] (0,0) -- (1,0); does not help to raise the arrow because TikZ computes the arrow's bounding box and places its bottom side on the baseline. But saying Code: \tikz[>=stealth',baseline]\draw[yshift=.5ex,to reversed->] (0,0) -- (1,0); does the job because the "baseline=y" option (p. 117) puts the coordinate (0,y) on the baseline ("baseline" is an abbreviation for "baseline=0pt"). Finally, if you are going to use this arrow in math formulas, wrap it in \mathrel{...} to create spaces before and after suitable for a relation. • Mar 25th 2012, 12:53 PM vernal Re: fixed the Distance, please help me Quote: Originally Posted by emakarov OK, let's make a list. The empty space you are talking about is created by the instruction "\path[use as bounding box] (-1.5,0) rectangle (0,0)". As p. 166 of the TikZ 2.10 manual says, the instruction adds a rectangle with length 1.5cm to the previous bounding box, which contains the arrow. To remove the extra space, get rid of this instruction. It is not necessary to have an empty math formula inside a node: "\node (1) {$$}" is the same thing as "\node (1) {}".

The part "node {}" in "\draw[to reversed->] (1) -- node {} (2)" does not make any difference: it just creates an empty node in the middle of the path.

The code of the picture can be made rather small, so instead of saying "\begin{tikzpicture} ... \end{tikzpicture}" you can say "\tikz ... ;".

It is not necessary to declare nodes (1) and (2) and then draw an arrow between them. The default space between nodes created by "right=of 1" is 1cm (p. 187 of the manual, option "node distance"). Therefore, a similar result can be achieved by
Code:

\tikz[>=stealth']\draw[to reversed->] (0,0) -- (1,0);
The main difference is that now the arrow is located at the baseline level. The reason why the arrow is raised in your version with nodes is that nodes are not empty. Due to the option "inner sep" (p. 175), a node with no text is in fact a rectangle 2/3em by 2/3em by default. You can see this by saying "\node[draw]" instead of just "\node". Thus, in your example the arrow is 1/3em above the baseline. A drawback is that the line is drawn not between the nodes' centers but between the middles of the nodes' sides facing each other. This introduces a 2/3em space before and after the arrow in addition to the regular TeX text spaces. To get rid of this horizontal space, you can say "\node[inner xsep=0pt]". However, it is better to get rid of nodes at all.

Saying
Code:

\tikz[>=stealth']\draw[to reversed->] (0cm,.5ex) -- (1cm,.5ex);
or
Code:

\tikz[>=stealth']\draw[yshift=.5ex,to reversed->] (0,0) -- (1,0);
does not help to raise the arrow because TikZ computes the arrow's bounding box and places its bottom side on the baseline. But saying
Code:

\tikz[>=stealth',baseline]\draw[yshift=.5ex,to reversed->] (0,0) -- (1,0);
does the job because the "baseline=y" option (p. 117) puts the coordinate (0,y) on the baseline ("baseline" is an abbreviation for "baseline=0pt").

Finally, if you are going to use this arrow in math formulas, wrap it in \mathrel{...} to create spaces before and after suitable for a relation.

emakarov