[bug#71602] gnu: texlive-scripts: add mktexfmt

Message ID CM8ctR0aIM2Hsd4u2h3ySzVLXZMdKdWGJP2dmR_jM_ZEvneWa_rPETFk5idr-dF1B6DsgzMGCK-i5okcq95lqPJ6G5PGAcGT69cZCRHbRyQ=@protonmail.com
State New
Headers
Series [bug#71602] gnu: texlive-scripts: add mktexfmt |

Commit Message

spencerpeters June 16, 2024, 7:08 p.m. UTC
* gnu/packages/tex.scm (texlive-scripts): add mktexfmt

Hello. I have noticed while using a modular TeX Live installation that the texlive-scripts package
lacks mktexfmt, which is necessary for creating TeX fmts. TeX Live places mktexfmt in a
separate folder from the remainder of the scripts in this package, but mktexfmt is simply
a symlink to fmtutil, which is included in this Guix package. As such, this patch adds a phase to
the build system to create this symlink after fmtutil has been installed. An alternative solution would
be to add the mktexfmt file in the upstream TeX Live repository as a source location, but since that
file is still only a symlink to fmtutil, I believe it is easier to create the symlink ourselves as the package
is built. I apologize if there are any errors as this is my first patch.

Best,
Spencer
---
gnu/packages/tex.scm | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

--
2.45.1
  

Comments

Nicolas Goaziou June 17, 2024, 7:18 a.m. UTC | #1
Hello,

spencerpeters via Guix-patches via <guix-patches@gnu.org> writes:

> * gnu/packages/tex.scm (texlive-scripts): add mktexfmt

Good catch.

> Hello. I have noticed while using a modular TeX Live installation that the texlive-scripts package
> lacks mktexfmt, which is necessary for creating TeX fmts.

Actually, it is not strictly necessary. Guix uses "fmtutil-sys" to
generate such fmts.  But you're right, the script should be installed anyway.

> #:link-scripts
> - (find-files "scripts")))))))))
> + (find-files "scripts"))))))
> + (add-after 'link-scripts 'link-mktexfmt
> + (lambda _
> + (let ((fmtutil (string-append #$output "/bin/fmtutil")))
> + (symlink fmtutil
> + (string-append #$output "/bin/mktexfmt" ))))))))

I integrated this in the `link-scripts' phase, and pushed to "tex-team"
branch. "mktexfmt" should be available once this branch is merged.

Regards,
  
Jorge Acereda June 30, 2024, 11:34 a.m. UTC | #2
Hi,

Any ETA for the merge? This breaks emacs org-mode export to latex.

Thanks,
  Jorge
  
Nicolas Goaziou June 30, 2024, 2:32 p.m. UTC | #3
Hello,

Jorge Acereda <jacereda@gmail.com> writes:

> Any ETA for the merge?

This should happen soon. Currently, the branch is being built on QA[¹].

> This breaks emacs org-mode export to latex.

This is rather surprising. "mktexfmt" is not directly used to compile
documents, but rather to create format files. However, these format
files are pre-generated during build, without relying on "mktexfmt".

Also, I can export from Org to LaTeX without issues. Your problem lies
elsewhere, IMO. Maybe an incomplete TeX Live installation ?


Regards,

[¹]  https://qa.guix.gnu.org/branch/core-updates
  
Jorge Acereda June 30, 2024, 4:47 p.m. UTC | #4
On Sun, Jun 30, 2024 at 4:32 PM Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:
> This is rather surprising. "mktexfmt" is not directly used to compile
> documents, but rather to create format files. However, these format
> files are pre-generated during build, without relying on "mktexfmt".
>
> Also, I can export from Org to LaTeX without issues. Your problem lies
> elsewhere, IMO. Maybe an incomplete TeX Live installation ?
>

Oh, sorry. I mean org-latex-export-to-pdf. Maybe I'm missing something
as you suggest. I have installed  texlive-bin, texlive-etex and
texlive-scripts. This is what I'm getting:

This is pdfTeX, Version 3.141592653-2.6-1.40.25 (TeX Live 2023/GNU
Guix) (preloaded format=pdflatex)
 restricted \write18 enabled.

kpathsea: Running mktexfmt pdflatex.fmt
mktexfmt: No such file or directory
I can't find the format file `pdflatex.fmt'!
This is pdfTeX, Version 3.141592653-2.6-1.40.25 (TeX Live 2023/GNU
Guix) (preloaded format=pdflatex)
 restricted \write18 enabled.

kpathsea: Running mktexfmt pdflatex.fmt
mktexfmt: No such file or directory
I can't find the format file `pdflatex.fmt'!
This is pdfTeX, Version 3.141592653-2.6-1.40.25 (TeX Live 2023/GNU
Guix) (preloaded format=pdflatex)
 restricted \write18 enabled.

kpathsea: Running mktexfmt pdflatex.fmt
mktexfmt: No such file or directory
I can't find the format file `pdflatex.fmt'!


Thanks,
  Jorge
  
Nicolas Goaziou June 30, 2024, 5:10 p.m. UTC | #5
Jorge Acereda <jacereda@gmail.com> writes:

> On Sun, Jun 30, 2024 at 4:32 PM Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:
>> This is rather surprising. "mktexfmt" is not directly used to compile
>> documents, but rather to create format files. However, these format
>> files are pre-generated during build, without relying on "mktexfmt".
>>
>> Also, I can export from Org to LaTeX without issues. Your problem lies
>> elsewhere, IMO. Maybe an incomplete TeX Live installation ?
>>
>
> Oh, sorry. I mean org-latex-export-to-pdf. Maybe I'm missing something
> as you suggest. I have installed  texlive-bin, texlive-etex and
> texlive-scripts. This is what I'm getting:
>
> This is pdfTeX, Version 3.141592653-2.6-1.40.25 (TeX Live 2023/GNU
> Guix) (preloaded format=pdflatex)
>  restricted \write18 enabled.
>
> kpathsea: Running mktexfmt pdflatex.fmt
> mktexfmt: No such file or directory
> I can't find the format file `pdflatex.fmt'!

I see.

The first thing to know is the error above is a red herring. Formats
(i.e. ".fmt" files) are pre-generated when TeX Live packages are built.
When kpathsea library does not find one, it tries to generate it with
"mktexfmt", but the problem stems from the fact that you didn't install
the package containing the expected format in the first place. In this
case, the package texlive-latex-bin does provide it.

Anyway, the packages "texlive-bin, texlive-etex and texlive-scripts" are
clearly insufficient to compile any document. As indicated in the
manual, you should install collections of packages to create
a self-sufficient TeX Live distribution. For Org, at the very least, you
should start by installing texlive-collection-latexrecommended (and
remove the previous packages you had). The packages
texlive-collection-pictures (for PGF/TikZ) and
texlive-collection-fontsrecommended can be nice to have, too, but they
are optional for Org.

However, if you want a relatively small TeX Live installation, you may
want to stay away from texlive-collection-binextra,
texlive-collection-fontsextra, texlive-collection-fontutils, and
texlive-collection-latexextra, which can be quite large. I suggest to
pick the individual packages you need from them. Off the top of my head,
for Org, you may want:

- texlive-capt-of
- texlive-soul
- texlive-ulem
- texlilve-wrapfig

all from texlive-collection-latexextra.

Of course, if space is not an issue, installing
texlive-collection-latexextra (roughly 1500 packages, 1G) is an option.
There is also texlive-scheme-full (schemes are meta packages mixing
collections and sometimes individual packages), which installs all TeX
Live (4500 packages, 4G). But I really recommend to spend a few minutes
to select a sufficient TeX Live tree instead.

HTH,

Regards,
  
Jorge Acereda June 30, 2024, 5:49 p.m. UTC | #6
Hi Nicolas,

Thanks a lot for the detailed explanation, clearly a PEBKAC on my side.

On Sun, Jun 30, 2024 at 7:10 PM Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:
>
> - texlive-capt-of
> - texlive-soul
> - texlive-ulem
> - texlilve-wrapfig

You remember correctly, those plus texlive-collection-latexrecommended
did the trick.
  

Patch

diff --git a/gnu/packages/tex.scm b/gnu/packages/tex.scm
index 828bcde0e2..5df60193d8 100644
--- a/gnu/packages/tex.scm
+++ b/gnu/packages/tex.scm
@@ -383,7 +383,12 @@  (define-public texlive-scripts
(apply (assoc-ref tex:%standard-phases 'link-scripts)
(list #:outputs outputs
#:link-scripts
- (find-files "scripts")))))))))
+ (find-files "scripts"))))))
+ (add-after 'link-scripts 'link-mktexfmt
+ (lambda _
+ (let ((fmtutil (string-append #$output "/bin/fmtutil")))
+ (symlink fmtutil
+ (string-append #$output "/bin/mktexfmt" ))))))))
(inputs (list perl))
(home-page "https://www.tug.org/texlive/")
(synopsis "TeX Live infrastructure programs")