4

I currently use the following code to generate a table:

\documentclass{article}
\usepackage{booktabs}
\usepackage{array}
\usepackage{multicol}

\newcolumntype{Y}[1]{>{\raggedright\arraybackslash}p{#1}}

\newenvironment{kiquotes}{
    \noindent \begin{tabular}{|Y{\dimexpr 0.35\linewidth-2\tabcolsep}p{\dimexpr 0.65\linewidth-2\tabcolsep}|}
    \hline\addlinespace[0.3cm]
}{
    \addlinespace[0.3cm]\hline \end{tabular}\\[0.1cm]
    \par
}

\newcommand{\kiquote}[2]{#1: & \guillemotright{}#2\guillemotleft{} \\ }

\begin{document}

\begin{multicols}{2}
\begin{kiquotes} \kiquote{Someone}{Said something} \end{kiquotes}
\end{multicols}

\end{document}

However, the resulting table lacks borders where \addlinespace is added. How can I prevent this from happening such that I have a continuous border?

enter image description here

2 Answers 2

3

One option is to load the makecell package and use \setcellgapes{0.3cm}; the dimension 0.3cm is your choice. Before the tabular, you have to activate this setting by issuing the \makegapedcells command. If you want to undo the last command, issue the inverse \nomakegapedcells command.

\documentclass{article}
\usepackage{booktabs}
\usepackage{array}
\usepackage{multicol}
\usepackage{aeguill}    
\usepackage{makecell}  % <====
\setcellgapes{0.3cm}   % <====

\newcolumntype{Y}[1]{>{\raggedright\arraybackslash}p{#1}}

\newenvironment{kiquotes}{\makegapedcells   % <====
    \noindent\begin{tabular}{|Y{\dimexpr0.35\linewidth-2\tabcolsep}p{\dimexpr0.65\linewidth-2\tabcolsep}|}
    \hline
}{
    \hline \end{tabular}\\
    \par
}

\newcommand{\kiquote}[2]{#1: & \guillemotright{}#2\guillemotleft{} \\ }

\begin{document}

\renewcommand{\arraystretch}{1.0}
\begin{multicols}{2}
\begin{kiquotes} \kiquote{Someone}{Said something} \end{kiquotes}
\end{multicols}

\end{document}

enter image description here

Note:

A totally different idea that might fit your needs is to use a tcolorbox instead of tabulars, it has many flexible settings and can break across page borders.

1

Why not just set the content inside an \fbox:

enter image description here

\documentclass{article}

\usepackage[T1]{fontenc}

\newcommand{\kiquote}[2]{{%
  \noindent
  \setlength{\fboxsep}{3mm}% Locally adjust \fboxsep (change to suit your needs)
  \fbox{%
    \makebox[\dimexpr.35\linewidth-\fboxrule-\fboxsep][l]{#1:}%
    \makebox[\dimexpr.65\linewidth-\fboxrule-\fboxsep][l]{\guillemotright #2\guillemotleft}%
  }%
}}

\begin{document}

\kiquote{Someone}{Said something}

\end{document}

You must log in to answer this question.

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