2

I know there's already been a similar question, but I still can't solve this problem by myself... Following you find my preamble:

\documentclass[12pt, a4paper, oneside, BCOR=12mm, DIV=18, parskip=half, openany, captions=tableheading]{scrbook}[2001/07/30]
\linespread{1.5}
\usepackage[left=2.5cm, right=3.5cm, top=3cm, bottom=3cm]{geometry}
\usepackage[sfdefault,extralight]{FiraSans}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{epsfig}
\usepackage[english]{babel}
\usepackage{csquotes}
\usepackage[bookmarks=true]{hyperref}
\usepackage{bookmark}
\usepackage{booktabs}
\usepackage{longtable}
\usepackage[x11names,dvipsnames,svgnames,table]{xcolor}
\usepackage{array}
\usepackage{colortbl}

\definecolor{NO1}{HTML}{F2F2F2}
\newcommand{\myrowcolour}{\rowcolor{NO1}}
\usepackage[version=3]{mhchem}

\usepackage[singlespacing=true, automark]{scrlayer-scrpage}
\setkomafont{pageheadfoot}{\upshape}
\renewcommand*{\chapterheadstartvskip}{\vspace*{1.75\baselineskip}} %original = \vspace*{2.3\baselineskip}


\usepackage[style=authoryear, maxcitenames=1]{biblatex}
\addbibresource{references.bib}

In an extra file, which I icluded in the main - file with the simple \input{} command I would like to bild a table with following code:

\chapter{Example}
\section*{Example A}

\begin{longtable}{lccl}
    \toprule
    Column 1 & Column 2 & Column 3 & Column 4\\
    text & text & text & text\\
 ...
\end{longtable}

... but the first cell "Column 1" is always black. Doesn't matter which table type or how many rows or columns I am choosing, just can't get rid of this black cell. It also doesn't matter if I delete, rename and newly integrate the file... somehow the code works without any problem if I copy the table-code into an already existing one. So the problem occures only in a new created and integrated file.

Would be happy if someone could help me out :) franzi

5
  • 2
    With the information you provided so far, I can't reproduce the issue.
    – leandriis
    Commented Mar 20, 2021 at 18:38
  • 2
    Is there a \cellcolor{black} (or \myrowcolour) somewhere in your main file before the \include{...} command that corresponds to the table in which you observe the black cell? Do you get any error messages upon compiling your code?
    – leandriis
    Commented Mar 20, 2021 at 18:57
  • There is a \newcommand{\myrowcolour}{\rowcolor{NO1}} but NO1 is gray (I checked thr html code)
    – Jes
    Commented Mar 20, 2021 at 19:06
  • 4
    please always provide code in a form that we can see the problem. Unrelated but don't load epsfig unless you need to emulate documents from the 1980s. Commented Mar 20, 2021 at 19:10
  • 2
    I can reproduce the black cell ONLY if I put \myrowcolour somewhere before the table. But also I get errors while compiling. No matter which color is NO1. Commented Mar 20, 2021 at 19:12

1 Answer 1

1

This is not an answer, more like solving the inverse problem.

I was able to produce code that compiles OK, without errors or warnings, and produces a black cell in a second table!

Perhaps it helps to find the original cause.

b

This is the code after the posted preamble.

\begin{document}
    
\section*{Example I}

\begin{longtable}{lccl}
    \toprule
    \myrowcolour    Column 1 & Column 2 & Column 3 & Column 4\\
    text & text & text & text\\
    \myrowcolour    % this is causing the issue <<<<<<
\end{longtable}

\section*{Example II}

\begin{longtable}{lccl}
    \toprule
    Column 1 & Column 2 & Column 3 & Column 4\\
    text & text & text & text\\
    ...
\end{longtable}

\end{document}
1
  • you could have edited this in to the question (but thanks, I wouldn't have guessed what the OP had done:-) Commented Mar 20, 2021 at 20:15

You must log in to answer this question.

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