2

I am creating a kind of commutative diagram with different types of arrows. So far, I have defined different line styles for my different types of map, like this:

\tikzstyle{map}=[->,>=stealth',semithick]
\tikzstyle{incmap}=[semithick, right hook-latex]
\tikzstyle{typemap}=[->,>=latex',thin, dashed]

This way, I declare all my nodes in the layout that I want, and then I can declare maps between them easily using \draw[<style>]. In addition, I can easily switch the style of a map (e.g. from a inclusion map to a normal one) if I decide that it is not the correct one.

Now, I want to create an arrow style for partial maps that looks like a normal arrow with a circle in the midpoint (no matter the length of the arrow). I know that I can do this in a one-by-one fashion, but I would like to be able to define that in a style, in a similar way to the others. To clarify, the arrows should look like this:

-o->
--o-->
---o--->

Any suggestions?

I am not using TikZ's cd library, but I have checked it and there is nothing that solves the problem.

Thanks in advance!

EDIT: As suggested, I add here the MWE with my initial status.

\documentclass{standalone}
\usepackage{tikz}

\usetikzlibrary{arrows,positioning,shapes}

\begin{document}
\begin{tikzpicture}[on grid,node distance=20mm]

\tikzstyle{element}=[inner sep=2pt,minimum height=1.3em,font=\itshape]
\tikzstyle{label}=[auto,midway,font=\itshape,inner sep=2pt]
\tikzstyle{map}=[->,>=stealth',semithick]
\tikzstyle{incmap}=[semithick, left hook-latex]
\tikzstyle{typemap}=[->,>=latex',thin, dashed]

\node[element] (l)  []  {L};
\node[element] (i)  [right of=l]    {I};
\node[element] (r)  [right of=i]    {R};

\draw[map]      (l) to node [label,above]   (lm)    {l}     (i);
\draw[incmap]   (r) to node [label,above]   (rm)    {r}     (i);

\end{tikzpicture}
\end{document}
  • Maybe this will help you: tex.stackexchange.com/questions/38495/… – Michael Palmer Nov 17 '16 at 15:23
  • Welcome to TeX.SX! Please, whenever adding a question provide a Minimum Working Example, starting with \documentclass, showing what you have done so far and ending with \end{document}. Furthermore, do not use \tikzstyle as it's deprecated (use \tikzset{key/.style={stuff}} instead). Check the markings decoration to do what you wish: tex.stackexchange.com/q/4986/114143, it's possible to place circles instead of arrows as well. – Guilherme Zanotelli Nov 17 '16 at 15:37
  • Thanks a lot to both of you! @GuilhermeZ.Santos, your solution worked for me. Should I edit my post to add the Minimal Working Example? I will post the answer now, if that is ok. – Fernando Nov 17 '16 at 16:47
  • You are welcome! That's always good (to add the MWE), you can also answer your own question, no problem there. – Guilherme Zanotelli Nov 17 '16 at 16:58
  • why you change correct syntax tikzset with obsolete tikzstyle? – Zarko Nov 18 '16 at 11:35
1

Using markings worked perfectly. Here is how I solved it:

\documentclass{standalone}
\usepackage{tikz}

\usetikzlibrary{arrows,positioning,shapes,decorations.markings}

\begin{document}
\begin{tikzpicture}[on grid,node distance=20mm,
  decoration={markings,mark=at position 0.5 with {\draw circle [radius=.4ex];}}]

\tikzset{element/.style={inner sep=2pt,minimum height=1.3em,font=\itshape}}
\tikzset{label/.style={auto,midway,font=\itshape,inner sep=2pt}}
\tikzset{map/.style={->,>=stealth',semithick}}
\tikzset{incmap/.style={semithick, left hook-latex}}
\tikzset{partmap/.style={->,>=latex,semithick,postaction={decorate}}}

\node[element] (l)  []  {L};
\node[element] (i)  [right of=l]    {I};
\node[element] (r)  [right of=i]    {R};

\draw[partmap]  (l) to node [label,above]   (lm)    {l}     (i);
\draw[incmap]   (r) to node [label,above]   (rm)    {r}     (i);

\end{tikzpicture}
\end{document}

Thanks again to the people who answered!

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.