I am tweaking my CV and I am defining a custom list environment. Consider the following MWE:
\documentclass{article}
\usepackage{ragged2e}
\pagestyle{empty}
\setlength{\tabcolsep}{0pt}
\newenvironment{entrylist}{%
\noindent
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}rl}
}{%
\end{tabular*}
}
\renewcommand{\bfseries}{}
\newcommand{\entry}[4]{%
#1&\parbox[t]{10.00cm}{\strut%
\textbf{#2}%
\hfill%
{\footnotesize #3\par}%no!\\%
#4\vspace{\parsep}%
}\\}
\begin{document}
\begin{entrylist}
\entry
{Office}
{A very fancy building in a very fancy place}
{}
{}
\entry
{Website}
{www.somename.com}
{}
{}
\entry
{Email}
{somename a aaa}
{}
{}
\entry
{Phone}
{+00 0000 000000}
{}
{}
\end{entrylist}
\end{document}
The MWE generates the following output:
The only problem that I have is the amount of white space between the left and the right columns. I need to reduce the spacing between both columns without affecting the 10cm length specified in #1&\parbox[t]{10.00cm}{\strut%
nor the textwidth specified in \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}rl}
. Essentially, I just need the left column to be closer to the right column. Can anybody help me reduce the white space between both columns?
EDIT
After the comments, I realised my question may have an unclear wording, so let me try again. Im my document, I call several entrylists
. I need all such entrylists
to satisfy two conditions:
(1) the same, reasonable separation between left & right columns;
(2) the white space between columns to be horizontally aligned.
I don’t seem to be able to achieve (1) & (2) simultaneously. Either I get a reasonable separation between right and left columns or I get the right column to be correctly aligned across entrylists
. But, no matter what I try, I don’t seem to get both (1) & (2) at the same time.
I show here why David Carlisle’s answer achieves (1) but not (2). In his answer, David suggests to have:
\documentclass{article}
\usepackage{ragged2e}
\pagestyle{empty}
\newenvironment{entrylist}{%
\noindent
\begin{tabular}{@{}rl}
}{%
\end{tabular}
}
\renewcommand{\bfseries}{}
\newcommand{\entry}[4]{%
#1&\parbox[t]{10.00cm}{\strut%
\textbf{#2}%
\hfill%
{\footnotesize #3\par}%no!\\%
#4\vspace{\parsep}%
}\\}
\begin{document}
\begin{entrylist}
\entry
{Office}
{A very fancy building in a very fancy place}
{}
{}
\entry
{Website}
{www.somename.com}
{}
{}
\entry
{Email}
{somename a aaa}
{}
{}
\entry
{Phone}
{+00 0000 000000}
{}
{}
\end{entrylist}
\begin{entrylist}
\entry
{Longer name}
{A very fancy building in a very fancy place}
{}
{}
\entry
{Much much longer name}
{www.somename.com}
{}
{}
\entry
{Email}
{somename a aaa}
{}
{}
\entry
{Phone}
{+00 0000 000000}
{}
{}
\end{entrylist}
\end{document}
The output that is generated satisfies (1) but not (2), because the column separation in the first environment is not aligned with the column separation in the second environment. See the output:
I am really sorry for not having worded my question better since the beginning —my bad.
Thank you all for your time.
EDIT I now show how Bernard’s answer achieves the desired output but alters the spacing before a section title. He suggests to have something like
\documentclass{article}
\usepackage{ragged2e}
\usepackage{eqparbox}
\pagestyle{empty}
\newenvironment{entrylist}{%
\noindent
\begin{tabular*}{\textwidth}{@{}r@{\enspace}l@{}}
}{%
\end{tabular*}
}
\renewcommand{\bfseries}{}
\newcommand{\entry}[4]{%
\eqmakebox[H][r]{#1}&\parbox[t]{10.00cm}{\strut%
\textbf{#2}%
\hfill%
{\footnotesize #3\par}%no!\\%
#4\vspace{\parsep}%
}\\}
\begin{document}
\begin{entrylist}
\entry
{Office}
{A very fancy building in a very fancy place}
{}
{}
\entry
{Website}
{www.somename.com}
{}
{}
\entry
{Email}
{somename a aaa}
{}
{}
\entry
{Phone}
{+00 0000 000000}
{}
{}
\end{entrylist}
\section*{Whatever fancy title you can think of}
\begin{entrylist}
\entry
{Longer name}
{A very fancy building in a very fancy place}
{}
{}
\entry
{Much much longer name}
{www.somename.com}
{}
{}
\entry
{Email}
{somename a aaa}
{}
{}
\entry
{Phone}
{+00 0000 000000}
{}
{}
\end{entrylist}
\end{document}
The output is as follows:
You can check that the subtitle is lower when compared with the original code:
I don’t know why Bernard’s answer lowers the title, but I suspect it may have something to do with the eqparbox
package.
Best Answer
You are forcing the two columns as far apart as possible using
\extracolsep
so the natural thing to do is to usetabular
nottabular*
and use the natural separation soHowever that produces
due to your setting of
which says that by default table columns should touch with no separation.
If you delete that line you get
Or if you need that for other parts of the document add some space with eg
or whatever space you need.