3

I have defined a custom tabularenvironment that has a heading for each table. I have managed to get some vertical space between the heading and the table itself. However, the first column of the table is indented. I'd like to get rid of that indentation:

Environment with indented table

Here's my code:

\documentclass{scrartcl}

\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc}

\setlength{\parindent}{0pt} % This doesn't have the desired effect

\newenvironment{grouping}[1]
{\newcommand{\entry}[3]{##1 - ##2 & ##3 \\}
\textbf{#1}

\vspace{0.20cm}
\begin{tabular}{l@{\hspace{1cm}}l}
}{\end{tabular}}

\begin{document}
\begin{grouping}{Heading}
\entry{A}{B}{First Entry} 
\entry{C}{D}{Second Entry}
\end{grouping}
\end{document}
  • 1
    \begin{tabular}{@{}l@{\hspace{1cm}}l} – egreg May 10 '15 at 9:14
3

The “indentation” is due to the padding that's inserted by default at either side of a column in a tabular; you can suppress it with @{}.

\documentclass{scrartcl}

\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc}

\newenvironment{grouping}[1]
  {\newcommand{\entry}[3]{##1 -- ##2 & ##3 \\}%
   \noindent\textbf{#1}\\*[2mm]% no page break here!
   \begin{tabular}{@{}l@{\hspace{1cm}}l}}
  {\end{tabular}}

\begin{document}
\begin{grouping}{Heading}
\entry{A}{B}{First Entry} 
\entry{C}{D}{Second Entry}
\end{grouping}
\end{document}

enter image description here

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.