Re: input Datei in tabular

Ulrike Fischer <[email protected]>
Newsgroups gmane.comp.tex.german
Message-ID <[email protected]>
Am Tue, 21 Feb 2023 20:24:03 +0100 schrieb fi:

 
> \documentclass{article}
> \begin{document}
> \begin{tabular}{|r|r|r|}
>   A & B & C \\
>   \hline
>   \input{dat}
>   \hline
> \end{tabular}
> \end{document}

> Ein neuerer pdflatex-Compiler (LaTeX2e <2020-10-01>) wirft folgende Fehlermeldung:
> 
> \hline ->\noalign 
>                   {\ifnum 0=`}\fi \hrule \@height \arrayrulewidth \futurelet...
> l.9   \hline
> 

> - wie kann man die Fehlermeldung bzw. den einsamen Eintrag am Ende erklären?
> 
> - ist \input innerhalb einer \tabular-Umgebung vielleicht verboten?

im Prinzip schon. \input in LaTeX war noch nie expandierbar, und
daher nur begrenzt in tabular benutzbar. Z.B. ein \multicolumn am
Beginn deiner dat.tex hätte schon immer einen Fehler gegeben. 

Seit der Einführung der diversen Datei-Hooks (texdoc ltfilehook) ist
\input nun völlig "unexpandierbar" und es geht fast gar nichts mehr.

Du brauchst eine expandierbare \input-Variante \expandableinput. Die
kannst du entweder direkt benutzen. Oder du benutzt einen
Umgebungshook um innerhalb von tabular \input umzudefinieren:

https://tex.stackexchange.com/a/611803/2388


\ExplSyntaxOn
\cs_new:Npn \expandableinput #1
  { \use:c { @@input } { \file_full_name:n {#1} } }
\AddToHook{env/tabular/begin}
  { \cs_set_eq:NN \input \expandableinput }
\ExplSyntaxOff



-- 
Ulrike Fischer 
http://www.troubleshooting-tex.de/

-- 
FAQ: http://texfragen.de/
Durchsuchbares Archiv: https://www.listserv.dfn.de/sympa/arc/tex-d-l 
Unsubscribe/Verwaltung: https://www.listserv.dfn.de/sympa/info/tex-d-l
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.