Is there any way to get the storebox package to work with tex4ebook?
A MWE based on the storebox document is:
\documentclass{article}
\usepackage{storebox}
\newstorebox{\mybox}
\begin{document}
\storebox{\mybox}{Contents of box}
\usestorebox{\mybox}
\usestorebox{\mybox}
\end{document}
According to the documentation, this only stores one copy of the box in the pdf file to reduce the size of the file. It also says that the package only works with pdflatex or lualatex.
I want to use this with tex4ebook with repeated images like the modified chessboard command discussed here. I want to define a box with
\storebox{\mybox}{%
\begin{center}
\mychessboard
\end{center}}
}
and use \usestorebox{\mybox} as needed in the file.
If the same chessboard is used later on, the idea is to use the previously generated image instead of creating a new one.
Thank you.
Update:
I have just discovered that using the solution from @Michal.h21 doesn't work for a mobi output.
The output from the command
tex4ebook -r 133 -f mobi mwename.tex
is
Amazon kindlegen(Windows) V2.9 build 1029-0897292
A command line e-book compiler
Copyright Amazon.com and its Affiliates 2014
*************************************************************
Error(xmlmake):E27012: Item or process id already used: mwename0x_png
Pack mobi 2
Is there any way to avoid this error?
If I generate an epub, Calibre will convert the file to mobi without any errors. However, I have noticed that the Calibre conversion is not always correct with other files and so I want to avoid this if possible.
Thanks for any help.
Update 2:
@Michal.h21
Using the new tex4book files still causes an error. If I generate the epub, it runs ok but hangs when I try to view it with Calibre:
If I generate the mobi, I get an error:
Error(core):E1005: Could not access file.
in file: C:\Users\User\AppData\Local\Temp\mbp_7E1_1_1D_E_C_1F_3E7_3574_2508_1\OEBPS\mwename.html
Do you get these errors?
Thank you.
Correction:
I have noticed that the epub run gives a tidy error at the end:
HTML Tidy for Windows released on 25 March 2009
Error: Can't open "mwename-epub/OEBPS/mwename.ncx"
Could this be the problem?
mwename.ncx exists in the working directory:
<?xml version="1.0"?>
<!DOCTYPE ncx PUBLIC "-//NISO//DTD ncx 2005-1//EN"
"http://www.daisy.org/z3986/2005/ncx-2005-1.dtd">
<ncx xmlns="http://www.daisy.org/z3986/2005/ncx/" version="2005-1"> <head>
<meta name="dtb:uid" content="http://example.com/mwename"/>
<meta name="dtb:depth" content="3"/>
<meta name="dtb:totalPageCount" content="0"/>
<meta name="dtb:maxPageNumber" content="0"/>
</head>
<docTitle>
<text>Unnamed</text>
</docTitle>
<navMap>
<navPoint id="mainentry" playOrder="1"> <navLabel><text>Document</text></navLabel> <content src="mwename.html" /> </navPoint></navMap>
</ncx>
It's not in the OEBPS directory. The OEBPS directory only has a file content.opf.


tex4ebook, you may install it from Github. I should update also the TeX distributions soon. – michal.h21 Jan 28 '17 at 11:29epubcheckdoesn't detect any errors. – michal.h21 Jan 29 '17 at 09:07mwename.ncxexist in your working directory? – michal.h21 Jan 30 '17 at 07:41mwename-epubdirectory. It is really strange that all files are missing from theOEBPSdirectory, don't you get some errors at the end of compilation, where files are copied to this directory? There should be something likeCopy: cp "mwename.html" "mwename-epub/OEBPS"– michal.h21 Jan 30 '17 at 08:32