I tried to run tex4ebook on the same MWE of this question (actually I tried also with a much more complex source, getting the same problem)

\section{section 1}
this is a test



tex4ebook test.tex -format epub3 -shell-escape

and I got the following error:

tex4ebook:unable to convert to number: -m

I just updated with tlmgr update --self --all --reinstall-forcibly-removed my TexLive 2016 Windows distribution (which updated tex4ht among others), and htlatex works correctly on my system. For example, running

htlatex test.tex "xhtml,charset=utf-8,fn-in,3,next,mouseover" " -cunihtf -utf8"

produces the expected xhtml file.

Any clue?


You can use two formats to pass options to tex4ebook, short and long names. Short options begin with one -, while long options begin with --. The problem in your case is that you want to use long names, but you start them with just one -, so tex4ebook tries to recognize them as as short ones.

You should either use

tex4ebook  --format epub3 --shell-escape test.tex

as long options, or

tex4ebook  -sf epub3 test.tex

for short options. As you can see, you can collapse multiple short options into one.

  • About the double -- I guess you might want to fix the documentation on CTAN ( mirrors.ctan.org/support/tex4ebook/tex4ebook-doc.pdf ), since from that PDF seems that also the full length option version (like format) should be called with a single -. I guess Tex replaced the double dash with a single longer dash. – mmj Jul 31 '16 at 19:16
  • you are right, I've missed that. it is indeed the issue that double hyphen is replaced with dash – michal.h21 Jul 31 '16 at 19:38

The problem is with the syntax you are using. Instead of:

tex4ebook test.tex -format epub3 -shell-escape

please try:

tex4ebook --format epub3 -s test.tex

The epub will be generated.

Note: The problem is fixed when the last argument is the filename.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.