0

How can I use an arrow as a substitute for \hline to create the appearance of an $x$ axis in a table? How would one add an axis name to this line? How do I create a similar feature for the vertical separator line? What can I use instead of say c|c to make a vertical axis and add a name as in $t$ at the end of arrow?

EDIT

Here is an MWE of a basic table, I want the horizontal separator to be replaced by an arrow, with a $t$, to represent the $t$-axis. And the vertical separator to be replaced with an arrow pointing downward, showing $x$ to represent the $x$ axis. Due to large size of my table there is no room for additional lines to box the table.

\documentclass{article}
\usepackage{diagbox}
\begin{document}
\begin{table}
\begin{center}
\begin{tabular}{c | c c c c c c}
\diagbox{$i$}{$j$} & $0$ & $1$ & $2$ & $3$  &  $4$  &  $5$  \\
\hline
-2& .& .&. &. & . & . \\
-1& .& .&. &. & . & . \\
 0& .& .&. &. & . & . \\
 1& .& .&. &. & . & . \\
 2& .& .&. &. & . & . \\
 3& .& .&. &. & . & . \\
 \end{tabular}
 \end{center}
 \end{table}
 \end{document}
  • 1
    What's your final aim? To create an axis system with a table in it? There may be simpler ways... – TeXnician Aug 27 '17 at 16:55
  • @TeXnician I have two lines; one at the top and one at the left that separate time and space values from the numbers in the body of table. I just want to emphasize on table that time is horizontal and space is vertical pointing down. – Maesumi Aug 27 '17 at 17:11
3

Just a simple solution using a TikZ matrix (not fully optimal):

matrix

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{matrix}
\begin{document}
\begin{tikzpicture}
\matrix (f) [matrix of nodes,row sep=-\pgflinewidth,column 1/.style={nodes={rectangle,draw,minimum width=3em}},column 2/.style={nodes={rectangle,draw,minimum width=3em}}]
{
0   & 6 \\
1   & 3 \\
1   & 3 \\
};
\draw[->] (f.north west) -- (f.north east) node[midway,above] {Time};
\draw[->] (f.north west) -- (f.south west) node[midway,left] {Space};
\end{tikzpicture}
\end{document}
| improve this answer | |
3

A solution with an ordinary array and pst-node (+ auto-pst-pdf to compile with pdflatex -shell-escape):

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{array}
\usepackage{pst-node, auto-pst-pdf}

\begin{document}

\[ \begin{pspicture}
    \begin{array}{|c|c|}
      \hline
      \pnode[-1em, 3ex]{O}0 & 6 \pnode[1em, 3ex]{X} \\
      \hline
      1 & 3 \\
      \hline
      \pnode[-1em, -2ex]{Y}1 & 3 \\
      \hline
    \end{array}\everypsbox{\footnotesize}
    \psset{linewidth=0.5pt, linejoin=1, arrows= <->, arrowinset=0.12, labelsep=2pt}
    \psline(X)(O)(Y)\uput[r](X){$t$}
    \psset{linestyle=none, arrows =-, shortput=nab}
    \ncline{O}{X}^{Time}
    \ncline{O}{Y}_[nrot=:U]{Space}
  \end{pspicture}
\]

\end{document} 

enter image description here

| improve this answer | |
  • I get Package ifplatform Warning: shell escape is disabled, so I can only detect \ifwindows. ) ! Package auto-pst-pdf Error: "shell escape" (or "write18") is not enabled: auto-pst-pdf will not work! . See the auto-pst-pdf package documentation for explanation. Type H <return> for immediate help. ... l.134 Or turn off auto-pst-pdf.} % ? – Maesumi Aug 28 '17 at 23:56
  • Yes, you ghave to add this switch to compile with pdflatex. Other solution: remove aut-pst-pdf and compile with xelatex. – Bernard Aug 29 '17 at 0:07

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.