2

What is the correct/direct way to produce the following? It's like a table with no borders but the first column is itemized or should I use minipage. I also experimented with hfill but with no luck?

enter image description here

3 Answers 3

1

The good old tabbing environment can be very handy here!

\documentclass{article}

\usepackage{pifont}
\usepackage{amsmath}

\newcommand{\titem}{\ding{226}\quad}

\begin{document}

\begin{itemize}
\item \begin{tabbing}
Logical Operators\qquad \= greater or equal\qquad \= \kill
Matlab uses \emph{mostly} standard relational operators \\
\titem equal              \> $==$ \\
\titem \textbf{not} equal \> $\sim=$ \\
\titem greater than       \> $>$ \\
\titem less than          \> $<$ \\
\titem greater or equal   \> $>=$ \\
\titem less or equal      \> $<=$
\end{tabbing}

\item \begin{tabbing}
Logical Operators\qquad \= greater or equal\qquad \= \kill
Logical Operators   \> elementwise \> short-circuit (scalars) \\
\titem And          \> \&          \> \&\& \\
\titem Or           \> $|$         \> $||$ \\
\titem \textbf{Not} \> $\sim$  \\
\titem Xor          \> xor  \\
\titem All true     \> all \\
\titem Any true     \> any
\end{tabbing}

\end{itemize}

\end{document}

enter image description here

Add color, if you want to.

1

This approach uses tabular for the table with newly defined columns L and R by using the array package. The blue columns are created with column specification >{$\color{blue}}L{1cm}<{$}.

\documentclass{article}
\usepackage{array}
\usepackage{pifont}
\usepackage{xcolor}
\usepackage{amsmath}

\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{R}[1]{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}

\begin{document}

    \begin{itemize}
        \item Matlab uses \emph{mostly} standard relational operators \\
        \begin{tabular}{>{\ding{226}}R{1cm}<{}@{\hspace{1mm}}L{3cm}>{$\color{blue}}L{1cm}<{$}}
            & equal & == \\
            & \textbf{not} equal & \sim= \\
            & greater than & > \\
            & less than & < \\
            & greater or equal & >= \\
            & less or equal & <= \\
        \end{tabular}
        \item Logical Operators \hspace{1.7cm} elementwise \hspace{.4cm} short-circuit (scalars) \\
        \begin{tabular}{>{\ding{226}}R{1cm}<{}@{\hspace{1mm}}L{3cm}>{$\color{blue}}L{2cm}<{$}>{$\color{blue}}L{1cm}<{$}}
            & And & \& & \&\& \\
            & Or & | & || \\
            & \textbf{Not} & \sim&  \\
            & Xor & \text{xor}&  \\
            & All true & \text{all}&  \\
            & Any true & \text{any}&  \\
        \end{tabular}
    \end{itemize}

\end{document}

enter image description here

1

Here I use \makeboxes to address the issue. I set up a few enabling macros, \mbl for a left-aligned box of width \myindent, and \tcbl for blue text.

In the MWE, \myindent is set up as 1in but can be changed. I also used the default beamer indent icons.

\documentclass{beamer}
\def\myindent{1in}
\newcommand\mbl[1]{\makebox[\myindent][l]{#1}}
\newcommand\tcbl[1]{\textcolor{blue}{#1}}
\begin{document}
\begin{frame}
\begin{itemize}
\item MATLAB uses \textit{mostly} standard relational operators
\begin{itemize}
\item\mbl{equal}\tcbl{$==$}
\item\mbl{\textbf{not} equal}\tcbl{$\sim=$}
\item\mbl{greater than}\tcbl{$>$}
\item\mbl{less than}\tcbl{$<$}
\item\mbl{greater or equal}\tcbl{$>=$}
\item\mbl{less or equal}\tcbl{$<=$}
\end{itemize}
\item \makebox[\dimexpr\myindent+22pt\relax][l]{Logical operators}%
      \mbl{elementwise}%
      short-circuit (scalars)
\begin{itemize}
\item\mbl{And}\mbl{\tcbl{$\&$}}\tcbl{$\&\&$}
\item\mbl{Or}\mbl{\tcbl{$|$}}\tcbl{$||$}
\item\mbl{\textbf{Not}}\tcbl{$\sim$}
\item\mbl{Xor}\tcbl{xor}
\item\mbl{All true}\tcbl{all}
\item\mbl{Any true}\tcbl{any}
\end{itemize}
\end{itemize}

\end{frame}
\end{document}

enter image description here

Further input simplification can be achieved with the macro \tabitem{}{}{}

\documentclass{beamer}
\def\myindent{1.1in}
\newcommand\mbl[1]{\makebox[\myindent][l]{#1}}
\newcommand\tcbl[1]{\textcolor{blue}{#1}}
\newcommand\tabitem[3]{\item\mbl{#1}\mbl{\tcbl{#2}}\mbl{\tcbl{#3}}}
\begin{document}
\begin{frame}
\begin{itemize}
\item MATLAB uses \textit{mostly} standard relational operators
\begin{itemize}
\tabitem{equal}{$==$}{}
\tabitem{\textbf{not} equal}{$\sim=$}{}
\tabitem{greater than}{$>$}{}
\tabitem{less than}{$<$}{}
\tabitem{greater or equal}{$>=$}{}
\tabitem{less or equal}{$<=$}{}
\end{itemize}
\item \makebox[\dimexpr\myindent+22pt\relax][l]{Logical operators}%
      \mbl{elementwise}%
      short-circuit (scalars)
\begin{itemize}
\tabitem{And}{$\&$}{$\&\&$}
\tabitem{Or}{$|$}{$||$}
\tabitem{\textbf{Not}}{$\sim$}{}
\tabitem{Xor}{xor}{}
\tabitem{All true}{all}{}
\tabitem{Any true}{any}{}
\end{itemize}
\end{itemize}
\end{frame}
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .