Math & ScienceArrows pointing at each row in a matrix

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
eimund
Posts: 6
Joined: Mon Jul 20, 2009 1:09 pm

Arrows pointing at each row in a matrix

Post by eimund »

Hello everybody!

I am trying to make a matrix with arrows pointing at each row. Something like this I want

Code: Select all

               T
             |--->  A \in B
\exists A ---| F
             |--->  A \notin B

I have made something that comes close to what I want

Code: Select all

\newcommand{\tworightarrowsTF}[2]
{
-\hspace{-1.5mm}\left\vert 
  \begin{matrix}
     \hspace{-0.7mm} \xrightarrow{\mathtt{T}} #1 \\
     \hspace{-0.7mm}\xrightarrow{\mathtt{F}} #2 
  \end{matrix}\right.
}

The only thing I do not like about this solution is that the \vert delimiter extends beyond the arrows, something like this

Code: Select all

             | T
             |--->  A \in B
\exists A ---| F
             |--->  A \notin B
             |

If someone have any ideas, please share ;)

Best regards
Eimund Smestad

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
localghost
Site Moderator
Posts: 9201
Joined: Fri Feb 02, 2007 12:06 pm

Arrows pointing at each row in a matrix

Post by localghost »

I think the "Math mode" document probably has some solutions to this issue.


Best regards and welcome to the board
Thorsten
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes[/size]

¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Arrows pointing at each row in a matrix

Post by frabjous »

To me that looks like a sideways tree. Consider something like:

Code: Select all

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary[trees]
\begin{document}
\begin{tikzpicture}
      \node {$\exists A$}
	  [edge from parent fork right,grow=right,->,
	      sibling distance=3em, level distance=6em]
	  child {
	      node {$A \notin B$} 
	      edge from parent 
		node[below] {\ \ \ F}
	  }
	  child {
	    node {$A \in B$}
	      edge from parent
		node[above] {\ \ \ T}
	  };
\end{tikzpicture}
\end{document}
You can of course also do trees with pstricks and similar packages.
eimund
Posts: 6
Joined: Mon Jul 20, 2009 1:09 pm

Arrows pointing at each row in a matrix

Post by eimund »

Thank you very much for your feedbacks :) I have looked through Mate mode, but was unable to find something to solve this issue. I looked at \delimiterfactor, which apparently only works when you want to increase the height of the delimiter, and not to decrease it.

I also tried tikzpicture which seemed to be what I want, but there are some issues... If I have a long equations in the root node and short equations in the child nodes, then I get something like this

Code: Select all

                                     T
                                |---------> A \in B_{123}
D_{123}: \exists A \in B_{231} -|    F
                                |---------> A \notin B_{123}

or

Code: Select all

                 |-> A \in B_{123}
D_{123}: \exists A \in B_{231} 
                 |-> A \notin B_{123}
Neither are acceptable to me. I want fixed lenghts of the arrows regardless of the size of the nodes. Something like this

Code: Select all

                                    T
                                  |---> A \in B_{123}
D_{123}: \exists A \in B_{231} ---| F 
                                  |---> A \notin B_{123}
This arrow should preferably function as a symbol in math mode, since I would use it widely in complex equations. I wish for it to function like a delimiter with a arrow pointing at each row.

Eimund
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Arrows pointing at each row in a matrix

Post by frabjous »

You can change the distance between the nodes, and thereby, the size of the arrows, with the level distance setting. I don't know of a way offhand to make it the same regardless of the size of the nodes; my pgf/tikz experience is very limited. Perhaps you can figure out a way consulting the pgfmanual, or perhaps someone else will know how, or have a better solution.
Post Reply