I would like to define a tabular (yellow labels) type environment that looks identical to my list (green labels) environment. I can get them close but have not been able to get them exactly alike. If I don't include the parskip package then the the MWE below produce drastically different results.
With the parskip package I am close but not quite there:
Code:
\documentclass{article}
%\usepackage[parfill]{parskip}% <--- should work with or without this package.
\usepackage{showframe}
\usepackage{array}
\usepackage{xcolor}
\usepackage{enumitem}
\usepackage{tikz}
%% http://tex.stackexchange.com/questions/64982/why-is-parskip-zero-inside-a-minipage
\newlength{\currentparskip}
\newcommand*{\CircledText}[2][fill=green]{%
\tikz[baseline=(char.base)]{%
\node[
shape=circle,
draw=gray, thick,
fill opacity=0.3,
text opacity=1,
inner sep=0.8pt,
outer sep=0pt,
#1
] (char) {#2};}%
}%
%% --------------------------------- List Version
\newlist{MyExample}{enumerate}{2}%
\setlist[MyExample,1]{label=\protect\CircledText{\arabic*}}
\newcommand*{\MyList}{%
\par\noindent
\begin{MyExample}
\item First list item
\item Second list item
\end{MyExample}
}%
%% --------------------------------- Tabular Version
\newenvironment{MyExampleTabular}[2][]{%
\def\item{\stepcounter{MyExamplei}\CircledText[fill=yellow]{\arabic{MyExamplei}}}%
\renewcommand{\arraystretch}{1.7}%
\hspace{\dimexpr\leftmargin-\labelwidth\relax}% <-- close
%\hspace*{\labelsep}% <-- close
\tabular[#1]{#2}%
}{%
\endtabular%
}%
\newcommand*{\MyTabular}{%
\par\noindent
\begin{MyExampleTabular}{@{}l@{}>{\hspace{\labelsep}} l}
\item & First list item \
\item & Second list item \
\end{MyExampleTabular}
}%
\begin{document}
\textbf{Horizontal Alignment: Outside Minipage}
\MyList
\MyTabular
\textbf{Horizontal Alignment: Inside Minipage}
\setlength{\currentparskip}{\parskip}% save the value
\begin{minipage}{0.3\linewidth}
\setlength{\parskip}{\currentparskip}% restore the value
\MyList
\MyTabular
\end{minipage}%
\bigskip
\textbf{Vertical Alignment}
\begin{minipage}{0.3\linewidth}
\setlength{\parskip}{\currentparskip}% restore the value
\MyList
\end{minipage}%
% ----------------------------
\begin{minipage}{0.3\linewidth}
\setlength{\parskip}{\currentparskip}% restore the value
\MyTabular
\end{minipage}%
\end{document}






\itemindent, to move your tabular the last little bit to the right, as per this answer. I am curious, what are you trying to accomplish? Why not use an itemize environment, if you are looking for an itemize environment? AFAIK people tend to mutilate array-environments rather than tabular environments. You don't get\arraystretchwithout the array-package anyways, so you are depending on array already. Your tabular is an array already, I think. – Bananguin Jul 28 '16 at 08:08\arraystretchis defined in the latex format not a package. The only difference between array and tabular is array cells default to math mode, and I see no math here? – David Carlisle Jul 28 '16 at 08:23\makebox, etc to get the alignment correct, so would prefer to just be able to use atabularenvironment that has the same spacing for those few cases. – Peter Grill Aug 01 '16 at 03:58