latex3 / pdfresources

LaTeX PDF resource management
LaTeX Project Public License v1.3c
22 stars 5 forks source link

Text field incompatible with fancyhdr and tabularray #52

Closed ssimo3lsuhsc closed 7 months ago

ssimo3lsuhsc commented 1 year ago

Hello!!! \pdffield_textfield does not produce any output inside commands or environments offered by the fancyhdr or tabularray packages. That it does not work with fancyhdr is perhaps not surprising, as that package mentions that it is written for LaTeX 2e, However, tabularray is proudly LaTeX 3. If you've ever seen a paper form, you would know that it is laid out in a way that closely imitates the cells of a multirow, multicolumn table. I like the simple way in which tabularray allows me to define my rows and columns in terms of their spreading behavior rather than fixed widths. That is, it offers the X column option, originally from tabularx, but it is much simpler to specify growth factors in columns that need them in tabularray than in tabularx.

So why am I posting this here and not on tabularray's GitHub page? I want to learn more about how Ulrike Fischer programmed the LaTeX3 PDF form fields to ship out. I also am open to any alternatives to the packages above that might work better with what Fischer has done.

Here is my code:

%! Author = ssimo3
%! Date = 6/1/2023

% Preamble
\DocumentMetadata{}
\documentclass[11pt]{article}

% Packages
\usepackage{l3pdffield-testphase}
\usepackage{tabularray}

\ExplSyntax
[simple_expl3_text_field_brackets.pdf](https://github.com/latex3/pdfresources/files/11626346/simple_expl3_text_field_brackets.pdf)
On
\NewDocumentCommand{\textField}{m}{\pdffield_textfield:n{#1}}
\ExplSyntaxOff

% Document
\begin{document}
\begin{tblr}{rowspec={Q[t]}, colspec={X[1]}}
\textField{name=field1, width=2in, height=2em}
    \end{tblr}

\end{document}

Output

simple_expl3_text_field_brackets.pdf

Terminal code

C:\PortableApps.com\PortableApps\texlive\bin\windows\latexmk.exe -pdf -file-line-error -interaction=nonstopmode -synctex=1 -output-format=pdf "-output-directory=C:/Users/ssimo3/OneDrive - LSUHSC/EHS Forms/out" -lualatex -lualatex=C:/PortableApps.com/PortableApps/texlive/bin/windows/lualatex.exe simple_expl3_text_field_brackets.tex
Initial Win CP for (console input, console output, system): (CP437, CP437, CP1252)
I changed them all to CP1252
Rc files read:
  NONE
Latexmk: This is Latexmk, John Collins, 7 Jan. 2023. Version 4.79.
Latexmk: applying rule 'lualatex'...
Rule 'lualatex':  Reasons for rerun
Changed files or newly in use/created:
  simple_expl3_text_field_brackets.tex
Category 'changed_user':
  simple_expl3_text_field_brackets.tex

------------
Run number 1 of rule 'lualatex'
------------
------------
Running 'C:/PortableApps.com/PortableApps/texlive/bin/windows/lualatex.exe  -file-line-error -interaction=nonstopmode -synctex=1 -recorder -output-directory="out"  "simple_expl3_text_field_brackets.tex"'
------------
This is LuaHBTeX, Version 1.16.0 (TeX Live 2023) 
 restricted system commands enabled.
(./simple_expl3_text_field_brackets.tex
LaTeX2e <2022-11-01> patch level 1
 L3 programming layer <2023-03-30>
(c:/PortableApps.com/PortableApps/texlive/texmf-dist/tex/latex/latex-lab/docume
ntmetadata-support.ltx
(c:/PortableApps.com/PortableApps/texlive/texmf-dist/tex/latex/pdfmanagement-te
stphase/pdfmanagement-testphase.sty
(c:/PortableApps.com/PortableApps/texlive/texmf-dist/tex/latex/tagpdf/tagpdf-ba
se.sty)
(c:/PortableApps.com/PortableApps/texlive/texmf-dist/tex/latex/pdfmanagement-te
stphase/pdfmanagement-testphase.ltx
(c:/PortableApps.com/PortableApps/texlive/texmf-dist/tex/latex/l3experimental/l
3bitset/l3bitset.sty))))
(c:/PortableApps.com/PortableApps/texlive/texmf-dist/tex/latex/l3backend/l3back
end-luatex.def)
(c:/PortableApps.com/PortableApps/texlive/texmf-dist/tex/latex/pdfmanagement-te
stphase/l3backend-testphase-luatex.def
(c:/PortableApps.com/PortableApps/texlive/texmf-dist/tex/latex/pdfmanagement-te
stphase/l3ref-tmp.sty))
(c:/PortableApps.com/PortableApps/texlive/texmf-dist/tex/latex/pdfmanagement-te
stphase/pdfmanagement-firstaid.sty)
(c:/PortableApps.com/PortableApps/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2022/07/02 v1.4n Standard LaTeX document class
(c:/PortableApps.com/PortableApps/texlive/texmf-dist/tex/latex/base/size11.clo)
)
(c:/PortableApps.com/PortableApps/texlive/texmf-dist/tex/latex/pdfmanagement-te
stphase/l3pdffield-testphase.sty
(c:/PortableApps.com/PortableApps/texlive/texmf-dist/tex/latex/l3experimental/l
3draw/l3draw.sty
(c:/PortableApps.com/PortableApps/texlive/texmf-dist/tex/latex/l3kernel/expl3.s
ty)))
(c:/PortableApps.com/PortableApps/texlive/texmf-dist/tex/latex/tabularray/tabul
array.sty) (./out/simple_expl3_text_field_brackets.aux)
(c:/PortableApps.com/PortableApps/texlive/texmf-dist/tex/latex/base/ts1cmr.fd)
Overfull \hbox (17.0pt too wide) in paragraph at lines 20--21
[][] 
[1{c:/PortableApps.com/PortableApps/texlive/texmf-var/fonts/map/pdftex/updmap/p
dftex.map}] (./out/simple_expl3_text_field_brackets.aux))
(see the transcript file for additional information)
 406 words of node memory still in use:
   3 hlist, 1 vlist, 1 rule, 2 glue, 3 kern, 1 glyph, 4 attribute, 48 glue_spec
, 4 attribute_list, 1 write nodes
   avail lists: 2:87,3:6,4:6,5:22,6:6,7:70,8:1,9:76
<c:/PortableApps.com/PortableApps/texlive/texmf-dist/fonts/opentype/public/lm/l
mroman10-regular.otf>
Output written on simple_expl3_text_field_brackets.pdf (1 page, 14867 bytes).

SyncTeX written on simple_expl3_text_field_brackets.synctex.gz.
Transcript written on simple_expl3_text_field_brackets.log.
Latexmk: Getting log file 'out/simple_expl3_text_field_brackets.log'
Latexmk: Examining 'out/simple_expl3_text_field_brackets.fls'
Latexmk: Examining 'out/simple_expl3_text_field_brackets.log'
Latexmk: Log file says output to 'simple_expl3_text_field_brackets.pdf'
Latexmk: All targets () are up-to-date

Reverting Windows console CPs to (in,out) = (437,437)

Process finished with exit code 0
u-fischer commented 1 year ago

this has nothing to do with LaTeX2e versus LaTeX3: the textfield for example works fine in the old, standard tabular.

The problem is that tabularray processes its contents many times, and this confuses the field: it believes that their are four kid fields but at the end only one exists. Make a feature request at tabulararray that it offers some option to process a command only once

(There is a boolean \lTblrMeasuringBool but even with it, the field is process twice and that is once too much.)

\DocumentMetadata{uncompress}
\documentclass{article}
\usepackage{l3pdffield-testphase}
\usepackage{tabularray}
\begin{document}

\ExplSyntaxOn
\begin{tabular}{l}
\show\bla  %shown once
\pdffield_textfield:n{name=1,width=2cm}
\end{tabular}  

\begin{tblr}{l}
\show\blub % shown 4 times
\pdffield_textfield:n{name=2,width=2cm} 
\end{tblr}
\ExplSyntaxOff

\end{document}
ssimo3lsuhsc commented 1 year ago

I have more pressing things to do right now, so I'm wondering if you might get around to testing something before I myself have time to come back to it in the near future. This is by no means urgent; it's just a concession that I will not have time to test it today in particular. There is a chance it is already a feature of tabularray. Would https://mirrors.mit.edu/CTAN/macros/latex/contrib/tabularray/tabularray.pdf, section 3.2.3, "Expand Macros First," be what I'm after? Thanks again!!!

Stuart Simon, MM, MLIS Web Development and Outreach, Web Specialist Human Development Centerhttps://www.hdc.lsuhsc.edu/ Louisiana's UCEDD E: @.**@.> O: 504 556 7567 @.**@.https://www.linkedin.com/company/human-development-center-lsuhsc

@.**@.https://www.lsuhsc.edu/

From: Ulrike Fischer @.> Sent: Thursday, June 1, 2023 10:28 AM To: latex3/pdfresources @.> Cc: Simon, Stuart A. @.>; Author @.> Subject: Re: [latex3/pdfresources] Text field incompatible with fancyhdr and tabularray (Issue #52)

EXTERNAL EMAIL: EVALUATE

this has nothing to do with LaTeX2e versus LaTeX3: the textfield for example works fine in the old, standard tabular.

The problem is that tabularray processes its contents many times, and this confuses the field: it believes that their are four kid fields but at the end only one exists. Make a feature request at tabulararray that it offers some option to process a command only once

(There is a boolean \lTblrMeasuringBool but even with it, the field is process twice and that is once too much.)

\DocumentMetadata{uncompress}

\documentclass{article}

\usepackage{l3pdffield-testphase}

\usepackage{tabularray}

\begin{document}

\ExplSyntaxOn

\begin{tabular}{l}

\show\bla %shown once

\pdffield_textfield:n{name=1,width=2cm}

\end{tabular}

\begin{tblr}{l}

\show\blub % shown 4 times

\pdffield_textfield:n{name=2,width=2cm}

\end{tblr}

\ExplSyntaxOff

\end{document}

- Reply to this email directly, view it on GitHubhttps://github.com/latex3/pdfresources/issues/52#issuecomment-1572268957, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AE2FQOAD2XQ7XOEEKS35633XJCYHTANCNFSM6AAAAAAYXACUTU. You are receiving this because you authored the thread.Message ID: @.**@.>>

u-fischer commented 1 year ago

I have more pressing things to do right now,

I too. So when you have time again open an issue at tabularray.