2

i'm using this tikz-based library to draw nodes and arrows between them (https://github.com/jluttine/tikz-bayesnet). I want to draw an arrow that has a vertical line tip (|) (which usually means inhibition). How can this be done in tikz?

this is the code that draws a regular arrow from node "A" to node "B" that I want to replace with |:

\documentclass{article}  
\usepackage{tikz}
\usetikzlibrary{bayesnet}

\begin{document}

\begin{figure*}[!h]
\centering
\begin{tikzpicture}
  % Define nodes
  \node[const] (A) {$A$};
  \node[const, below=1cm of A] (B) {$B$};
  % connect them
  %%% how to make this an arrow with | tip?
  \edge{A}{B};
 \end{tikzpicture}
\caption{}
\end{figure*}
\end{document}

to compile you need the bayesnet package from the above link.

  • While code snippets are useful in explanations, it is always best to compose a fully compilable MWE that illustrates the problem including the \documentclass and the appropriate packages so that those trying to help don't have to recreate it. This is especially important for tikz as there are numerous libraries. Also missing is the definition of the const style, so a composing a a fully compilable MWE will help to flush out those details as well. – Peter Grill Jul 10 '16 at 22:07
  • Welcome! Please complete your code so it can be compiled. – cfr Jul 10 '16 at 22:07
  • @cfr I updated the code to have MWE. – mvd Jul 10 '16 at 22:29
  • You don't need to download the library if you have e.g. TeX Live installed. – cfr Jul 10 '16 at 22:59
3

Do you want something like this?

custom arrow

\documentclass[tikz,border=10pt,multi]{standalone}
\usetikzlibrary{bayesnet,arrows.meta}
\begin{document}
\begin{tikzpicture}
  \node[const] (A) {$A$};
  \node[const, below=1cm of A] (B) {$B$};
  \edge [-Bar] {A}{B};
\end{tikzpicture}
\end{document}
  • yes! is there a way to make the arrow end a bit before (higher) than "B"? – mvd Jul 10 '16 at 23:15
  • Have you tried shorten >=2pt or whatever? – cfr Jul 10 '16 at 23:22
  • Oops, sorry for the quick response, without deep thinking. I will delete it soon. – Jesse Jul 11 '16 at 0:35
  • @Jesse No problem! Very easily done ;). – cfr Jul 11 '16 at 8:23

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.