My white whale. I can't for the life of me figure out what's going on with the margins caused by minipage existing in the column definition.
Given column type M
extending c
:
I can change line 6 from >{
to >{%
and suddenly the left padding disappears while keeping the right padding. If I add a %
to the end of line 14 where minipage ends, then the padding on the right also disappears. This isn't how comments work...also, the tikz not aligning vertically in the minipage, which I thought I handled with \begin{minipage}[c]{#1}
.
I can change line 11 from c
to m{#1}
and now the line 6 and 14 %
doesn't have any effect..and the tikz is still not vertically centered (top indent exists). If I manually set the minipage to be the height of what's in the tikzpicture, 30pt, then there's a big margin up top. Then If I manually set the minipage height to be 34pt, the tikzpicture is vertically and horizontally centered on the minipage...
However, this doesn't solve my issue of making the minipage automatically adjust its height relative to its contents on any other table, or how to disregard that minimum padding at the top. It doesn't help that I can't seem to turn the height into a second variable passed to the column type M
, either.
If I set the column at 67.5pt, then the "hbox too wide" appears on the first tikz. However, the tikz is supposed to be (15+37.5+15=67.5) points wide. The overflow from the brown box shows me that minipage seems to have its own margins as well.
The tikzpicture options are only there to experiment with getting this alignment take care of.
All I want is perfectly centered tikz next to perfectly centered math, with the a single minimum margin applied to all 8 cells equally. If it could be automated, even better. This seems above my level of knowledge right now...and entirely unreasonable that this can/has become so needlessly complex
\documentclass{article}
\usepackage{array,longtable,tikz,calc}
\setlength{\tabcolsep}{0mm}
\newcolumntype{M}[1]
{
>{
\noindent\begin{minipage}[c][][c]{#1}%\textwidth-1.5\arrayrulewidth-2\tabcolsep}
%\vspace{0pt}
\centering
}
c
<{
%\vspace{0pt}
\end{minipage}
}
}
\newcolumntype{A}[1]
{%
>{$}
r
<{$}
@{\extracolsep{0pt}}
>{${}}
l
<{$}
|}%
\begin{document}
\begin{longtable}{| M{68.5pt} | A |}% \setstretch{1.0}%q{0.38} |}
\hline
\noindent\begin{tikzpicture}[every node/.style={inner sep=0,outer sep=0}]% ,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);
\draw [brown] (current bounding box.south west) rectangle (current bounding box.north east);
\end{tikzpicture}
& \underline{2r_c \sin \left( ^{\pi} \!/ _{n_k} \right)} &\geq 2r_f + R_1 r_f
\tabularnewline
\hline
\centering\begin{tikzpicture}[baseline=(current bounding box.south)]%[every node/.style={inner sep=0,outer sep=0}]
\draw [gray] (0,0) circle (15pt);
\filldraw [gray] (0,0) circle (1pt);
\draw [gray] (30pt,0) circle (15pt);
\filldraw [gray] (30pt,0) circle (1pt);
\draw [brown] (current bounding box.south west) rectangle (current bounding box.north east);
\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);
\draw [brown] (current bounding box.south west) rectangle (current bounding box.north east);
\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);
\draw [brown] (current bounding box.south west) rectangle (current bounding box.north east);
\end{tikzpicture}
& 2r_c \sin \left( ^{\pi} \!/ _{n_k} \right) &< \underline{2r_f}+R_1 r_f \tabularnewline
\hline
\end{longtable}
\end{document}