3

How can I reduce the spacing after I have used & in tabular?

\documentclass{article}
\usepackage{tabularx}

\begin{document}

\begin{tabularx}{\textwidth}{X X}
\textbf{Greetings} & Refer to counter parts as Mr., Ms. or Mrs \\
\textbf{Gift Giving} & Gift giving is practised but not necessary. Taking someone out is also considered a gift. Gifts are generally given to close a deal or to indicate some celebration. \\
\textbf{Dressing} & Business dressing is a must in the business place. It is recommended that one dresses more conservatively than their counterpart. In the east this a must but in the west, the dressing is relatively casual. \\
\textbf{Tipping} & Tipping not necessary but if the service is good then it should be used. \\
\textbf{Time Management} & Time is extremely important in America. Therefore, it is important that one arrives on time. Do not be surprised if the client is discontent due one's tardiness. 
\end{tabularx}

\end{document}

The main issue is that there is too much spacing after &, how can I fix that?

enter image description here

Moriambar
  • 11,466
Jeel Shah
  • 3,794
  • 1
    Perhaps chancing the first X to l. In your example you get two equal spaced columns. – daleif May 08 '13 at 13:29
  • @daleif If I do that then there isn't text wrapping. – Jeel Shah May 08 '13 at 13:30
  • 1
    There is no reason to wrap in the first column, only in the second column, which of course should remain marked as an X column – daleif May 08 '13 at 13:32
  • 3
    There isn’t too much spacing after & but before. Both columns are equally spaced. As @daleif said, use l (or >{\bfseries} to make your life easier because you don’t need \textbf anymore). If you still want wrapping for the first column use either p{<length>} or X with a certain \hsize. – Qrrbrbirlbel May 08 '13 at 13:36
  • Maybe http://tex.stackexchange.com/questions/16519/adding-space-between-columns-in-a-table is related. – Betohaku May 08 '13 at 13:51
  • @gekkostate For questions like these, please always add a picture of the output. – doncherry May 08 '13 at 15:38
  • @doncherry Sorry about that. I added it. – Jeel Shah May 08 '13 at 16:00
  • I can't help but chuckle over the use of the word "dressing"; it suggests that the text is quite antiquated. Nowadays (in US English at least!), one should use the term "dress code" for the topic at hand. The term "dressing", in contrast, is used for what one puts on a salad. – Mico May 08 '13 at 16:30

3 Answers3

3

Code

\documentclass{article}
\usepackage{tabularx,lipsum}

\begin{document}
\noindent
\begin{tabularx}{\textwidth}{@{}>{\bfseries}l X@{}}
    Greetings       & Refer to counter parts as Mr., Ms. or Mrs                                                                                                                                                                     \\
    Gift Giving     & Gift giving is practised but not necessary. Taking someone out is also considered a gift. Gifts are generally given to close a deal or to indicate some celebration.                                          \\
    Dressing        & Business dressing is a must in the business place. It is recommended that one dresses more conservatively than their counterpart. In the east this a must but in the west, the dressing is relatively casual. \\
    Tipping         & Tipping not necessary but if the service is good then it should be used.                                                                                                                                      \\
    Time Management & Time is extremely important in America. Therefore, it is important that one arrives on time. Do not be surprised if the client is discontent due one's tardiness.                                             \\
\end{tabularx}

\noindent\hrulefill

\noindent
\begin{tabularx}{\textwidth}{@{}>{\bfseries\raggedright}p{5em} X@{}}% \raggedright because justified text in such a narrow column is not good
    Greetings       & Refer to counter parts as Mr., Ms. or Mrs                                                                                                                                                                     \\
    Gift Giving     & Gift giving is practised but not necessary. Taking someone out is also considered a gift. Gifts are generally given to close a deal or to indicate some celebration.                                          \\
    Dressing        & Business dressing is a must in the business place. It is recommended that one dresses more conservatively than their counterpart. In the east this a must but in the west, the dressing is relatively casual. \\
    Tipping         & Tipping not necessary but if the service is good then it should be used.                                                                                                                                      \\
    Time Management & Time is extremely important in America. Therefore, it is important that one arrives on time. Do not be surprised if the client is discontent due one's tardiness.                                             \\
\end{tabularx}

\noindent\hrulefill

\noindent
\begin{tabularx}{\textwidth}{@{}>{\bfseries\raggedright\hsize=.4\hsize}X >{\hsize=1.6\hsize}X@{}}
    Greetings       & Refer to counter parts as Mr., Ms. or Mrs                                                                                                                                                                     \\
    Gift Giving     & Gift giving is practised but not necessary. Taking someone out is also considered a gift. Gifts are generally given to close a deal or to indicate some celebration.                                          \\
    Dressing        & Business dressing is a must in the business place. It is recommended that one dresses more conservatively than their counterpart. In the east this a must but in the west, the dressing is relatively casual. \\
    Tipping         & Tipping not necessary but if the service is good then it should be used.                                                                                                                                      \\
    Time Management & Time is extremely important in America. Therefore, it is important that one arrives on time. Do not be surprised if the client is discontent due one's tardiness.                                             \\
\end{tabularx}

\noindent
\begin{tabularx}{\textwidth}{@{}X@{\hspace{4em}}X@{}}
\lipsum*[1] & \lipsum*[1]
\end{tabularx}
\end{document}

Output

enter image description here

enter image description here

Moriambar
  • 11,466
Qrrbrbirlbel
  • 119,821
  • This changes the width of the first column allright, but how is the whitespace between these two columns reduced? – Betohaku May 08 '13 at 13:42
  • Add @{} in appropriate places – daleif May 08 '13 at 13:46
  • @Betohaku You can insert arbitrary code between columns with @{}, you could also do something like @{\hspace{3cm}} or whatever you like. The standard space inserted between columns is 2\tabcolsep (before the first and after the last column a space of \tabcolsep is inserted). – Qrrbrbirlbel May 08 '13 at 13:52
  • @Qrrbrbirlbel It seems to me it is exactly that that gekkostate is after. Could you put this in your answer with explanation? That would be worth my vote. – Betohaku May 08 '13 at 13:54
  • I like the look of the first example the best. I'd suggest also getting rid of the whitespace before the first column and after the third column (by inserting @{} in the corresponding places). – Mico May 08 '13 at 16:24
  • @Mico While I usually disagree in adding @{} before the first and after the last column in normal tables (we had this discussion before), here I agree due to the nature of the presented text. (It’s not really a table.) – Qrrbrbirlbel May 08 '13 at 16:37
1

For example:

\documentclass{article}
\usepackage{tabularx}

\begin{document}

\newlength{\first}
\settowidth{\first}{\textbf{Time Management }}

\begin{tabularx}{\textwidth}{p{\first} X}
\textbf{Greetings} & Refer to counter parts as Mr., Ms. or Mrs \\
\textbf{Gift Giving} & Gift giving is practised but not necessary. Taking someone out is also considered a gift. Gifts are generally given to close a deal or to indicate some celebration. \\
\textbf{Dressing} & Business dressing is a must in the business place. It is recommended that one dresses more conservatively than their counterpart. In the east this a must but in the west, the dressing is relatively casual. \\
\textbf{Tipping} & Tipping not necessary but if the service is good then it should be used. \\
\textbf{Time Management} & Time is extremely important in America. Therefore, it is important that one arrives on time. Do not be surprised if the client is discontent due one's tardiness. 
\end{tabularx}

\end{document}

enter image description here

Moriambar
  • 11,466
  • There is an disadvantage to this; you would have to keep checking if a new row has a wider first-column entry. Furthermore; would it be an idea to add something like \addtolength\first{<some width>} so that the user can play with the whitespace? – Betohaku May 08 '13 at 13:46
  • 2
    @Betohaku I assume that OP knows, which entry is the longest one. – Przemysław Scherwentke May 08 '13 at 13:50
  • 1
    Sure he would, but it is an extra operation if there is a longer line added. Every time the user adds a new line, he might have to change the \settowidth. – Betohaku May 08 '13 at 13:53
  • 1
    In this case (setting \first to the longest cell) you can just use l. – Qrrbrbirlbel May 08 '13 at 14:24
  • @Qrrbrbirlbel Certainly. My solution gives an opportunity of trimming fist column to a value less than maximal width of entries, but in some way connected with them. I do not know, why gekkostate didn't want to use simply l. – Przemysław Scherwentke May 08 '13 at 14:30
0

Another solution could be

\documentclass{article}
\usepackage{tabularx}

\begin{document}

\begin{tabularx}{\textwidth}{X!{\vrule width -3cm} X}
\textbf{Greetings} & Refer to counter parts as Mr., Ms. or Mrs \\
\textbf{Gift Giving} & Gift giving is practised but not necessary. Taking someone out is also considered a gift. Gifts are generally given to close a deal or to indicate some celebration. \\
\textbf{Dressing} & Business dressing is a must in the business place. It is recommended that one dresses more conservatively than their counterpart. In the east this a must but in the west, the dressing is relatively casual. \\
\textbf{Tipping} & Tipping not necessary but if the service is good then it should be used. \\
\textbf{Time Management} & Time is extremely important in America. Therefore, it is important that one arrives on time. Do not be surprised if the client is discontent due one's tardiness. 
\end{tabularx}

\end{document}

Where you can set -3cm to whatever value you want.

Solution taken from White space between columns using \rowcolor{somecolor}.

Moriambar
  • 11,466
Francisco
  • 769