Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

There are a few accounting figures which I am making, and I need to add curly braces and arrows with boxes of text inside near table environments. Here is an example figure: example

I want to use TikZ for this, in combination with a tabular enviroment maybe? This just looks so difficult that I'm not even sure what to start with to give you a sample code of my attempt. Also, I'm not sure how to use a 'rule' style command which just underlines a certain column as in the figure, not the entire row.

share|improve this question
    
I think you want \cmidrule{a-b} which will draw a midrule between column a and column b. \midrule draws one the whole width of the table. Or, without booktabs (not recommended), use \cline{a-b}. –  cfr Jun 1 at 19:13

2 Answers 2

up vote 1 down vote accepted

How about this:

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{decorations.pathmorphing,decorations.pathreplacing,calc}

\begin{document}

\begin{minipage}{.48\textwidth}
\tikzstyle{block} = [rectangle, draw, fill=blue!20, text width=6.5em, text centered, rounded corners, minimum height=3.25em]
\begin{tikzpicture}[overlay]
\def \n {3}
\coordinate (a0) at (\n,-0.5);
\coordinate (a1) at (\n,-1);
\coordinate (a2) at (\n,-1.5);
\draw[decoration={brace,amplitude=0.6em,mirror},decorate,ultra thick,gray]($(a1)!(a0.north)!($(a1)-(0,1)$)$) --  ($(a1)!(a2.south)!($(a1)-(0,1)$)$);
\node[block] at ($(a1)-(1.85,0)$) {text 1};

\coordinate (b1) at (\n,-2.5);
\draw[->,ultra thick,gray](b1) --  ($(b1)+(1,0)$);
\node[block] at ($(b1)-(1.85,0)$) {text 2};
\end{tikzpicture}
\end{minipage}
\begin{minipage}[t]{.48\textwidth}
Bla, bla\ldots\\[2mm]

\begin{tabular}{lll}
A & B & C\\
1 & 3 & 3\\
2 & 4 & 6
\end{tabular}

text \ldots
\end{minipage}
\end{document}

The rest is fine tuning of the coordinates.

share|improve this answer
    
Thank you! I was able to figure out how all of this works from your answer. –  Samuel Reid Jun 1 at 21:34

I personally would recommend using the infamous \tikzmark. With this you:

  • complete the table as you normally would
  • mark specfic points with a \tikzmark{<name>}
  • access these \tikzmarks in a \tikzpicture with the [overlay,remember picture] options and draw as desired.

This allows one to separate the tabular date form the drawings that needs to be added.

enter image description here

Note:

Code:

\documentclass{article}

\usepackage{tikz}
\usepackage{siunitx}
\usepackage{booktabs}
\usetikzlibrary{decorations.pathreplacing}

\newcommand{\tikzmark}[1]{\tikz[overlay,remember picture] \node[baseline] (#1) {};}

\tikzset{My Node Style/.style={midway, right, xshift=3.0ex, align=left, font=\small, draw=blue, thin, fill=cyan!25, text=black}}

\newcommand\VerticalBrace[4][]{%
    % #1 = draw options
    % #2 = top mark
    % #2 = bottom mark
    % #4 = label
  \draw[decorate,decoration={brace, amplitude=1.5ex}, #1] 
    ([yshift=1ex]#2.north east)  -- ([yshift=-1ex]#3.south east)
        node[My Node Style] {#4};
}

\newcommand\DrawArrow[3][]{%
    % #1 = draw options
    % #2 = mark
    % #3 = label
  \draw[<-, shorten >=0.1cm, #1] 
    ([shift={(0.0cm,0.5ex)}]#2.east)  -- ([shift={(1.0cm,0.5ex)}]#2.east)
        node[My Node Style] {#3};
}


\begin{document}
\begin{tabular}{llrr}
\multicolumn{4}{c}{Big Dog Carworks Corp.}\tikzmark{Heading Top} \\
\multicolumn{4}{c}{Income Statement} \\
\multicolumn{4}{c}{For the month eded Jan. 31, 2015}\tikzmark{Heading Bottom} \\
\multicolumn{2}{l}{Revenues} \\[0.5ex]
    & Repair Revenues && \$ \num{15000} \\
\multicolumn{2}{l}{Expenses} \\
    & Rent Expense & \$ \num{1500} \\
    & Salaries Expense & \$ \num{3500} \\
    & Supplies Expense & \$ \num{3500} \\
    & Fuel Expense & \$ \num{3500} \\
    \cmidrule(lr){3-3}
    & Total Expenses && \$ \num{12000} \\
    \cmidrule(lr){4-4}
    & Net Income     && \$ \num{03000} \tikzmark{Net Income Mark}\\
\end{tabular}
\begin{tikzpicture}[overlay,remember picture]
    \VerticalBrace[ultra thick, blue]{Heading Top}{Heading Bottom}{%
        The heading shows the name \\
        of the entity, the type of \\
        financial statement, and the \\
        \textit{period-in-time} date.%
    }
    \DrawArrow[ultra thick, blue]{Net Income Mark}{%
        The net income is transferred \\
        to the statement of changes \\
        in equity.%
    }
\end{tikzpicture}

\end{document}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.