2
  • I am trying to make a template for gym workouts (a table that fills a whole page, see here if you are interested, German website).
  • Problem one is that the German umlauts (e. g. Ü) have too little space to the cell border.
  • Problem two is that the cell color is leaving the cell when the I use @{} in the column definition.
  • Apparently, I used the wrong search terms -- I could have bet that I am not the first person that encounters these problems.

\documentclass{article}

% For "Umlauts"
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}

\usepackage[
    a4paper,
    margin = 5mm,
    landscape,
    %showframe,
    ]
    {geometry}

% Table stuff
\usepackage{tabularx}

% Loads also "colortbl"
\usepackage[table]{xcolor}    

% Nice sans serif font :)
\usepackage[sfdefault]{cabin}

\begin{document}

\noindent
\begin{tabularx}{\textwidth}{@{}l|l|X|X@{}}
\hline
Übung & Parameter & \\
\hline
\cellcolor{blue!25} Color Cell & \cellcolor{blue!25} Color Cell  \\
\hline
\end{tabularx}

\end{document}

enter image description here

  • 2
    Keine Ursache ;-) – user31729 Apr 21 '17 at 21:21
  • 3
    for second question see tex.stackexchange.com/questions/365685/…, for the first: try to add \setlength{\extrarowheight}{2pt} – Zarko Apr 21 '17 at 21:28
  • Off-topic: Don't insert any whitespace between cellcolor{<some color>} and the cell's contents. Your screenshot shows the result of not adhering to this recommendation... – Mico Apr 21 '17 at 21:32
  • @Mico Thanks. I didn't see any problem so far but I also didn't focus on that. – Dr. Manuel Kuehner Apr 21 '17 at 21:33
  • 1
    @Dr.ManuelKuehner - For your first question, you should check out this answer to the query Column and row padding in tables. – Mico Apr 21 '17 at 21:37
2

You can play with the optional arguments of \colorcolumn. For the umlauts problem, a simple \extrarowheight will do. I took the liberty of changing the input encoding to utf8, which is understood by all OSes and modern editors.

\documentclass{article}

% For "Umlauts"
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\usepackage[
    a4paper,
    margin = 5mm,
    landscape,
    %showframe,
    ]
    {geometry}

% Table stuff
\usepackage{tabularx}


% Loads also "colortbl"
\usepackage[table]{xcolor}

% Nice sans serif font :)
\usepackage[sfdefault]{cabin}

\begin{document}

\noindent\setlength\extrarowheight{3pt}
\begin{tabularx}{\textwidth}{@{}>{\columncolor{blue!25}[0pt][\tabcolsep]}l|>{\columncolor{blue!25}}l|X|X@{}}
\hline
\rowcolor{white}Übung & Parameter & \\
\hline
Color Cell & Color Cell & & \\
\hline
\end{tabularx}

\end{document} 

enter image description here

  • +1 for changing the inputenc option to utf8. :-) – Mico Apr 21 '17 at 21:44
  • Thanks! Maybe I wasn't clear in my example. I want to change the row color manually for some rows. In your code I need to change it to white in many rows ;). – Dr. Manuel Kuehner Apr 21 '17 at 21:45
  • @Mico I still like to use latin1:). – Dr. Manuel Kuehner Apr 21 '17 at 21:45
  • 1
    @Dr.ManuelKuehner - If you've set up your editor to use latin1 as the input encoding system, you automatically make your code unusable and unsuitable for processing by XeLaTeX and LuaLaTeX. Even if you don't anticipate having to use either of these two LaTeX formats for the foreseeable future, why would you deliberately create an incompatibility that will be quite tedious to undo if and when you decide to switch to a more modern LaTeX format? Put differently, why do you not wish to use utf8 input encoding? – Mico Apr 21 '17 at 21:51
  • 1
    I tried first using the optional arguments for row colours, but this leaves white spaces in the internal cells, due to this dissymmetry in \tabcolsep, so I don't see a way to obtain what you want at the row level. – Bernard Apr 21 '17 at 21:52

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.