Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: embedfile support #99

Open
hanetzer opened this issue Jan 12, 2023 · 4 comments
Open

Feature request: embedfile support #99

hanetzer opened this issue Jan 12, 2023 · 4 comments

Comments

@hanetzer
Copy link

Should be easy enough in theory, at least for epub format (idk too much about mobi) since you can just plop the
file into the zip.

~/texlive/2022/texmf-dist/tex/generic/embedfile/embedfile.sty 185 Package embedfile Error: Missing pdfTeX in PDF mode.
^error presented at current invocation.

@michal-h21
Copy link
Owner

The problem is that not all file types are supported in Epub, so it is not a good idea to embed arbitrary files. But some supported files, such as videos or audio, should work.

I will make a pull request to the package to remove the error message, and add a support for embedfile commands to TeX4ht sources.

@michal-h21
Copy link
Owner

The basic embedfile.4ht can look like this:

% embedfile.4ht (2023-01-12-14:40), generated from tex4ht-4ht.tex
% Copyright 2023 TeX Users Group
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either
% version 1.3c of this license or (at your option) any
% later version. The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3c or later is part of all distributions
% of LaTeX version 2005/12/01 or later.
%
% This work has the LPPL maintenance status "maintained".
%
% The Current Maintainer of this work
% is the TeX4ht Project <http://tug.org/tex4ht>.
%
% If you modify this program, changing the
% version identification would be appreciated.
\immediate\write-1{version 2023-01-12-14:40}

\NewConfigure{embedfile}{1}
\Configure{embedfile}{{\Configure{Needs}{File: \embed:file}\Needs{}}}
\newcommand\embedfile[2][]{
  \edef\embed:file{#2}%
  \a:embedfile%
}

% dummy commands that can be used in the document
\newcommand\embedfilefinish{}
\newcommand\embedfilesetup[1]{}
\newcommand\embedfilesort[1]{}
\newcommand\embedfilefield[2]{}
\newcommand\embedfileifobjectexists[4]{}
\newcommand\embedfilegetobject[2]{}

\Hinput{embedfile}
\endinput

It doesn't fix the Missing pdfTeX error, that will be hopefully fixed by my pull request.

@hanetzer
Copy link
Author

The problem is that not all file types are supported in Epub, so it is not a good idea to embed arbitrary files. But some supported files, such as videos or audio, should work.

Ah. well, my use case isn't 'supported' files per se. I just like the idea of documents which contain their
own source code, as a preservation thing.

@michal-h21
Copy link
Owner

That sound not possible with Epub, unfortunately. But I've added embedfile support to TeX4ht, so you shouldn't get errors in the near future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants