1

I have an issue with \input when using the new versions of LuaLateX. I include this MWE and afterwards some figures of the issue. I'm testing the code in Overleaf.

The problem is that when I'm using LuaLateX version 2020 the outcome is Figure 1, while if a use newer ones (i.e. 2022) I get Figure 2. If you notice it seems that \input is including a white space. I have tried to apply the answer to this question but unfortunately it is not working in tables.

If I don't use \input and I directly insert the code in books.tex file in main.text everything works and I get Figure 1.

Could you please give me some hints?

TA

  • main.tex
\documentclass[a4paper, 11pt]{scrartcl}
\usepackage[utf8x]{inputenc}
\usepackage{fontspec}
\setmainfont{Times New Roman}

\usepackage[ left=1.8cm, right=2cm, top=3cm, bottom=1.25cm ]{geometry}

\usepackage{longtable,tabu} \newcount\totalcol \newdimen\cola \newdimen\colb \newdimen\colc \newdimen\cold \newdimen\cole \newdimen\colf

\usepackage{tabularx} \usepackage{array} \newcolumntype{L}[1]{>{\raggedright\let\newline\\arraybackslash\hspace{0pt}}m{#1}} \newcolumntype{C}[1]{>{\centering\let\newline\\arraybackslash\hspace{0pt}}m{#1}} \newcolumntype{R}[1]{>{\raggedleft\let\newline\\arraybackslash\hspace{0pt}}m{#1}} \renewcommand{\tabularxcolumn}[1]{>{\centering\arraybackslash}m{#1}}

\newcommand{\mydata}[4]{ {#1} & {#2} & {#3} \ \hline }

\begin{document}

\newcount\totalcol \newdimen\cola \newdimen\colb \newdimen\colc

\totalcol=3 \cola=7.8cm \colb=2.8cm \colc=\dimexpr\textwidth-\tabcolsep\totalcol2-\arrayrulewidth*(1+\totalcol)-\cola-\colb\relax

\begin{longtable}{|>{\footnotesize}L{\cola}|>{\footnotesize}C{\colb}|>{\footnotesize}L{\colc}|} \hline \multicolumn{3}{|c|}{\large\textbf{Title}}\ \hline \centering\small{Item 1} & \centering\small{Item 2} & \centering\arraybackslash\small{Item 3}\ \hline \endhead \hline \endfoot% \input{books}

\end{longtable}

\end{document}

  • books.tex
\mydata{
a1}{
b1}{
c1}{
d1
}

\mydata{ a2}{ b2}{ c2}{ d2 }

\mydata{ a3}{ b3}{ c3}{ d3 }

  • Figure 1

Blank row is not there

  • Figure 2

Last blank row should not be there

jlanza
  • 1,249
  • 1
    I can't test now but try with \input books instead of \input{books}. BTW, you've got lots of spurious spaces, you shouldn't load inputenc with LuaTeX, and I'm not entirely sure what \let\newline\\ should be doing. – campa Aug 10 '23 at 13:42
  • it's not really related to \input you have \\ \hline then a \par from the blank line then \end{longtable} so you have started a new row, – David Carlisle Aug 10 '23 at 15:35
  • @campa yes latex input is not (has never been) expandable so it has some interesting effects in tables, but if you add a \par in a cell you will get a non empty cell unless you rely on low level tex primitives silently discarding it. so I'd say the output shown is the expected output even if tex primitive input manages to avoid it. – David Carlisle Aug 10 '23 at 15:39
  • @DavidCarlisle and yet the output is correct even with that blank line. It puzzles me too, but that's how it is... – campa Aug 10 '23 at 15:43
  • @campa sure yes the primitive input absorbs the white space to end the filename, so there is no \par` – David Carlisle Aug 10 '23 at 15:45
  • @DavidCarlisle Ah, of course. Thx. – campa Aug 10 '23 at 15:46
  • @campa it works the way you say. However I don't understand the reason. What is the difference between input with and without brackets? – jlanza Aug 28 '23 at 14:17
  • Without brackets the TeX primitive is used, which (as David explained in comment) gobbles the space after the filename. With brackets a lot of other stuff happens, and the space isn't gobbled away. – campa Aug 28 '23 at 15:11
  • I guess you can post the answer with your name ;) Otherwise I will do so, referencing the comment and close the issue – jlanza Aug 28 '23 at 19:37

0 Answers0