2

I just posted recently, it was marked duplicate, and a lot of the errors I made were corrected. Now, an updated question and the context

One issue I just noticed is that the tikzpicture isn't centered in the minipage in the table. How can I resolve this?

Using the below code, I noticed that I need to include a second | at the end of my column definition. If I don't, then I won't have the right column line. Unsure why?

Additionally, I'd like to know if there's a way to set the padding for the tikzpicture's minipage environment and the left/right equation column pair to be the same, so that the table size doesn't have to be manually controlled?

Context: I'm trying to make a two column table with a tikzpicture on the left and an equation on the right, aligned at the equality symbols. Utilizing 1, 2, and 3, I have arrived at the following:

\documentclass{article}
\usepackage{tikz,array,longtable,calc} % Not 100% sure if I actually need calc?
\newcolumntype{M}[1]
{
    >{
        \begin{minipage}{#1\textwidth-1.5\arrayrulewidth-2\tabcolsep}
        \vspace{\tabcolsep}
        \centering
    }
    c
    <{
        \vspace{\tabcolsep}
        \end{minipage}
    }
}
\newcolumntype{A}[1]
{%
    >{$}
        r
    <{$}
    @{\extracolsep{0pt}}
    >{${}}
        l
    <{$}
}%
\begin{document}
\begin{longtable}{| M{0.22} | A ||}
\hline
    \begin{tikzpicture}[baseline=(current bounding box.center)]
        \draw [gray] (0,0) circle (15pt);
        \filldraw [gray] (0,0) circle (1pt);
        \draw [gray] (37.5pt,0) circle (15pt);
        \filldraw [gray] (37.5pt,0) circle (1pt);
    \end{tikzpicture} & \underline{2r_c \sin \left( ^{\pi} \!/ _{n_k} \right)}  &\geq  2r_f + R_1 r_f 
    \tabularnewline
\hline
    \begin{tikzpicture} [baseline=(current bounding box.center)]
        \draw [gray] (0,0) circle (15pt);
        \filldraw [gray] (0,0) circle (1pt);
        \draw [gray] (30pt,0) circle (15pt);
        \filldraw [gray] (30pt,0) circle (1pt);
    \end{tikzpicture} & 2r_c \sin \left( ^{\pi} \!/ _{n_k} \right)  &\leq   2r_f+\underline{R_1 r_f} \tabularnewline
\hline
    \begin{tikzpicture} [baseline=(current bounding box.center)]
        \draw [gray] (0,0) circle (15pt);
        \filldraw [gray] (0,0) circle (1pt);
        \draw [gray] (22.5pt,0) circle (15pt);
        \filldraw [gray] (22.5pt,0) circle (1pt);
    \end{tikzpicture} & 2r_c \sin \left( ^{\pi} \!/ _{n_k} \right)  &<   \underline{2r_f}+R_1 r_f \tabularnewline
\hline
    \begin{tikzpicture} [baseline=(current bounding box.center)]
        \draw [gray] (0,0) circle (15pt);
        \filldraw [gray] (0,0) circle (1pt);
        \draw [gray] (11.25pt,0) circle (15pt);
        \filldraw [gray] (11.25pt,0) circle (1pt);
    \end{tikzpicture} & 2r_c \sin \left( ^{\pi} \!/ _{n_k} \right)  &<   \underline{2r_f}+R_1 r_f \tabularnewline
\hline
\end{longtable}
\end{document}
  • In my continued efforts to properly center the tikz/minipage/longtable entry bonanza, I have arrived at the following and cannot find the options or lengths that affect the top or left margins of the graphics. \documentclass{article} – Ronen Dec 5 '17 at 23:27
2

You have

\newcolumntype{A}[1]

so your A column takes an argument (the first |) but discards it as there is no #1 in the definition.

  • Well that solves one question. Now to figure out why tikz isn't centered, and how to do auto-padding.. – Ronen Dec 5 '17 at 21:17

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.