Update : the problem has been solved by adding \shorthandoff{:} before and \shorthandon{:} after the xltabular environment (thank you Jasper). The issue was caused because of the use uf the french language automatically adding a space before semicolons.
This post is very long so I can fully explain the problem I am encountering, please feel free to correct and edit anything and/or comment. I will answer to every question I know the answer of.
TeX infos : I compile with PDFLaTeX, write under TeXMaker, and the version is 3.141592653-2.6-1.40.25
So I have a table made with xltabular in which I am using a \mulicolumn command. As many other users, I am observing a small unwanted indent on the first line of this table. I have been browsing the forum for a week now, without finding the solution to my problem. Here are the questions/answers I have been applying to my code so far :
- egreg and Karl Hagen's solutions to this question : add
@{}and/or\dimexprand\tabcolsep. Addding one or the other or both does not get the indent off of my document, whatever the length in the command or the number of\tabcolsep. Also the same solutions are provided here. Those are not solving it. - Xu Wang's question and Werner's solution to this problem : add a
\noindentat the beginning of the table's line. No change whatsoever in the document on my side. - All solutions to this question :
\noindentbefore\begin{xltabular}; theflushleftenvironment ;\setlength{\parindent}{0pt}; etc. : no change either. - The
\ignorespacesfrom here, no change.
So I started wrinting my MWE, with theoretically only the needed packages, to show you my best try and what I had tried so far, but the output was slightly different, because no indentation appeared :
\documentclass[11pt,fleqn,french]{report}
\usepackage{geometry}
\geometry{a4paper}
\usepackage[utf8]{inputenc}
\usepackage[OT1]{fontenc}
\usepackage{makecell,hhline,longtable}
\usepackage[longtable]{multirow}
\usepackage{xltabular}
\renewcommand\tabularxcolumn[1]{m{#1}}
\newcolumntype{L}[1]{>{\raggedright\arraybackslash}m{#1}}
\newcolumntype{R}[1]{>{\raggedleft\arraybackslash}m{#1}}
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%
\begin{document}
\begin{center}
\begin{xltabular}{0.75\linewidth}{|c|L{40mm}@{}L{2mm}L{15mm}|}
\hhline{|t:====:t|}
\multicolumn{1}{|c|}{\textbf{Part}} & \multicolumn{3}{c|}{\textbf{Data}} \endfirsthead \hline
Material \textit{$\alpha$} & Mass\newline Volume\newline Density\newline Proportion & :\newline :\newline :\newline : & \textit{$m_{\alpha}$}\newline \textit{$v_{\alpha}$}\newline \textit{$\rho_{\alpha}$}\newline \textit{$p_{\alpha}$}\ \hline
Cylinder & Mass\newline Volume\newline Density & :\newline :\newline : & \textit{$m_{cyl}$}\newline \textit{$v_{cyl}$}\newline \textit{$\rho_{cyl}$}\
\hhline{|b:====:b|}
\end{xltabular}
\end{center}
\end{document}
Having reduced the number of packages not to pollute the MWE 1.0, my first thought was that the issue comes from some incompatibility between some of those. So here is my MWE 2.0, with all the packages I use and need, and its result :
\PassOptionsToPackage{x11names}{xcolor}
\documentclass[11pt,fleqn,french]{report}
\usepackage{geometry}
\geometry{a4paper}
\usepackage{background}
\backgroundsetup{contents=MWE}
\usepackage[utf8]{inputenc}
\usepackage[OT1]{fontenc}
\usepackage{pdflscape}
\usepackage{rotating}
\usepackage{booktabs,bigstrut}
\usepackage[parfill]{parskip}
\usepackage{graphicx,float}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{fancyhdr}
\usepackage{epstopdf}
\usepackage{lipsum}
\usepackage{babel,csquotes,xpatch}
\usepackage{ifthen}
\usepackage{array}
\usepackage{textcomp}
\usepackage{hyperref}
\usepackage{nomencl}
\usepackage[toc,acronym]{glossaries}
\usepackage[backend=biber,style=numeric-comp,sorting=none]{biblatex}
\usepackage{microtype}
\usepackage{caption,subfloat,subcaption}
\usepackage{wrapfig}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\usepgfmodule{plot}
\usepgfplotslibrary{fillbetween}
\usepackage{tikz}
\usetikzlibrary{calc,shapes,decorations.pathmorphing,backgrounds,plotmarks,3d,patterns}
\usepackage{makecell,hhline,longtable}
\usepackage[longtable]{multirow}
\usepackage[column=0]{cellspace}
\newcommand{\imageborder}{2pt}
\setlength\cellspacetoplimit{\imageborder}
\setlength\cellspacebottomlimit{\imageborder}
\usepackage[export]{adjustbox}
\usepackage{xltabular}
\renewcommand\tabularxcolumn[1]{m{#1}}
\newcolumntype{L}[1]{>{\raggedright\arraybackslash}m{#1}}
\newcolumntype{R}[1]{>{\raggedleft\arraybackslash}m{#1}}
\begin{document}
\begin{center}
\begin{xltabular}{0.75\linewidth}{|c|L{40mm}L{2mm}L{15mm}|}
\hhline{|t:====:t|}
\multicolumn{1}{|c|}{\textbf{Part}} & \multicolumn{3}{c|}{\textbf{Data}} \endfirsthead \hline
Material \textit{$\alpha$} & Mass\newline Volume\newline Density\newline Proportion & :\newline :\newline :\newline : & \textit{$m_{\alpha}$}\newline \textit{$v_{\alpha}$}\newline \textit{$\rho_{\alpha}$}\newline \textit{$p_{\alpha}$}\ \hline
Cylinder & Mass\newline Volume\newline Density & :\newline :\newline : & \textit{$m_{cyl}$}\newline \textit{$v_{cyl}$}\newline \textit{$\rho_{cyl}$}\
\hhline{|b:====:b|}
\end{xltabular}
\end{center}
\end{document}
As you can see, there is an obvious indentation on the first "subline" of each of the table's lines. My very first try was with a 3-column table, thus including a \multicolumn{2}{}{} for the data, and the indent was being applied to both ":" and the variables. My guess is this issue appears on the second column of the \multicolumn, but I don't get the reason why.
Any help would be very very much appreciated, please and thank you for your time and consideration.




frenchas language in your document. With this, thebabelpackage adds some space before a colon. To avoid that locally, you can add\shorthandoff{:)before the relevant part and\shorthandon{:)after it. Also see https://tex.stackexchange.com/q/155015/47927 for other solutions. – Jasper Habicht Jul 07 '23 at 17:43