4

Given the following table:

\begin{tabular}{|l|l|l|}
\hline
a & b & c \\ \hline
d & e & f \\ \hline
g & h & i \\ \hline
\end{tabular}

enter image description here

I could find the question Padding at the top of a table cell in LaTeX, saying about changing it for a top of the whole table.

How to set the left padding for the column a and for the cell f to 0, while keeping the rest of the cells and columns with default settings?

1
  • Why do you "accept" the very first (good) answer almost immediately? (You can always up-vote a good answer right away, of course.) If you waited a bit longer (say, 4 or 5 hours) before accepting an answer, you wouldn't be discouraging other answers from being posted.
    – Mico
    Apr 23, 2017 at 6:58

1 Answer 1

8

Like this?

enter image description here

\documentclass[12pt]{article}

\begin{document}
\begin{tabular}{|@{}l|l|l|}
\hline
a & b & c \\ \hline
d & e & \multicolumn{1}{@{}l|}{f} \\ \hline
g & h & i \\ \hline
\end{tabular}
\end{document}

Note: an above example is not moved content to left border of table but left border to content. Consequently, column is for \tabcolsep narrower (thank Mico for comment). For preserving equal column width (if this is requested) , this width can be added on the end of cell:

 \begin{tabular}{|@{}l@{\hspace{2\tabcolsep}}|l|l|}

which in treated case give:

enter image description here

4
  • Observe that this approach has the side effect of makin the first column narrower, in the amount of \tabcolsep. It may be worth pointing out this side-effect explicitly.
    – Mico
    Apr 23, 2017 at 7:01
  • @Mico, yo have right (again) :)
    – Zarko
    Apr 23, 2017 at 8:53
  • @chzzh, for cell f`` you had to change content align locally. The only way to get showed result is to use multicolumn` command. What you mean with "not wrap"
    – Zarko
    Jan 16, 2023 at 12:46
  • @chzzh, it is not clear (to me), what is your problem. Please. asl new question and explain what you like to achieve.
    – Zarko
    Jan 16, 2023 at 18:51

You must log in to answer this question.

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