manuels / texlive.js

Compiling LaTeX (TeX live) in your browser
http://manuels.github.com/texlive.js/
GNU General Public License v2.0
1.25k stars 139 forks source link

media9 plugin #11

Open soeren87 opened 11 years ago

soeren87 commented 11 years ago

Hello,

I am trying to get media9 package to work in order to produce media PDFs through the the webserver.

Is it possible to use the media9 plugin in texlive.js ? Mine isnt working.

Just saying:

... ! LaTeX Error: File `media9.sty' not found. ...

And I added the following to texlive.js:

media9: [ ['texlive/texmf-dist/tex/latex/media9/media9.sty', '/', 'media9.sty'] ],

Any suggestions ? Thank you very much for any kind of response!

/edit i think this is the problem: [quote] To use packages in texlive.js, the corresponding package file must be downloaded before compilation, otherwise pdftex will not be able to find these files. [/quote]

but how to compile on my own using windows ?

manuels commented 11 years ago

that looks fine. Did you check the network traffic e.g. in the developer tools of firefox for the media9.sty GET request?

soeren87 commented 11 years ago

Hello,

the dev tools of my browser displayed many errors. Many missing *.sty files, but not only the media9 !

Now I tried to build pdftex on my own. It compiled until:

Access denied on /home/soeren/texlive.js-master/website/pdftex.js/build-pdftex/texk/web2c/pdftex no such file or folder

can you help me ?

manuels commented 11 years ago

recompiling pdftex would be a pain in the ass ;) It's probably very simple to solve your problem: the path to the latex style files is incorrect.

check the GET requests URLs against the true URLs for your server and fix the path in

    var pdftex = new PDFTeX('./url/path/to/latex');

correspondingly

soeren87 commented 11 years ago

Hello,

it seems to be an other problem.

I can build the normal sample file without errors. But when adding: \usepackage{media9} there are many different errors.

here a part of the console of browser def tools:

PDFTeX: Object {cmd: "stdout", contents: "lstat(/bin) failed ..."} pdftex.js:34 PDFTeX: Object {cmd: "stdout", contents: "/bin"} pdftex.js:34 PDFTeX: Object {cmd: "stdout", contents: ":"} pdftex.js:34 PDFTeX: Object {cmd: "stdout", contents: " "} pdftex.js:34 PDFTeX: Object {cmd: "stdout", contents: "No such file or directory"} pdftex.js:34 PDFTeX: Object {cmd: "stdout", contents: "warning: kpathsea: configuration file texmf.cnf no…FAUTODIR/texmf/web2c:$SELFAUTOPARENT/texmf/web2c."} pdftex.js:34 PDFTeX: Object {cmd: "stdout", contents: "This is pdfTeX, Version 3.1415926-1.40.11 (TeX Live 2010)"} pdftex.js:34 PDFTeX: Object {cmd: "stdout", contents: "entering extended mode"} pdftex.js:34 PDFTeX: Object {cmd: "stdout", contents: "(./pdftex-input-file.tex"} pdftex.js:34 PDFTeX: Object {cmd: "stdout", contents: "LaTeX2e <2011/06/27>"} pdftex.js:34 PDFTeX: Object {cmd: "stdout", contents: "Babel <v3.8m> and hyphenation patterns for english, dumylang, nohyphenation, lo"} pdftex.js:34 PDFTeX: Object {cmd: "stdout", contents: "aded."} pdftex.js:34 PDFTeX: Object {cmd: "stdout", contents: "(./article.cls"} pdftex.js:34 PDFTeX: Object {cmd: "stdout", contents: "Document Class: article 2007/10/19 v1.4h Standard LaTeX document class"} pdftex.js:34 PDFTeX: Object {cmd: "stdout", contents: "(./size10.clo)) (./geometry.sty (./keyval.sty) (./ifpdf.sty) (./ifvtex.sty)"} pdftex.js:34 PDFTeX: Object {cmd: "stdout", contents: "(./ifxetex.sty)) (./graphicx.sty (./graphics.sty (./trig.sty) (./graphics.cfg)"} pdftex.js:34 PDFTeX: Object {cmd: "stdout", contents: "(./pdftex.def (./infwarerr.sty) (./ltxcmds.sty))))"} pdftex.js:34 PDFTeX: Object {cmd: "stdout", contents: ""} pdftex.js:34 PDFTeX: Object {cmd: "stdout", contents: "! LaTeX Error: File `media9.sty' not found."} pdftex.js:34 PDFTeX: Object {cmd: "stdout", contents: ""} pdftex.js:34 PDFTeX: Object {cmd: "stdout", contents: "Type X to quit or to proceed,"} pdftex.js:34 PDFTeX: Object {cmd: "stdout", contents: "or enter new name. (Default extension: sty)"} pdftex.js:34 PDFTeX: Object {cmd: "stdout", contents: ""}

Thank you very much for your support !

manuels commented 11 years ago

The only 'real' error here is 'media9.sty' not found. Looks like the urls to the other sty files (e.g. graphics.sty) are fine. Compare the GET request of graphics.sty and media9.sty and you'll probably find the error.

also check whether there is a GET request to media9.sty at all!

soeren87 commented 11 years ago

Now it has got the media9.sty.

Problem now, that media9 requires other packages which cannot be found.

It is possible to add them manually, but i think this is the problem you pointed out two posts ago.

When I change the main.js :

var pdftex = new PDFTeX('./');

to

var pdftex = new PDFTeX('texlive.js-master/website/texlive/texmf-dist/tex/latex');

it does not find files like "pdftex-webworker.js" anymore .

manuels commented 11 years ago

sorry, I mixed it up. the path in var pdftex = new PDFTeX('./'); must be configured to make it find pdftex-webworker.js. and texlive.compile(URL_TO_LATEX, ...) must be configured to make it find the *.sty files.

soeren87 commented 11 years ago

I added: var sty = "texlive/texmf-dist/tex/latex/";

to main.js.

the part of texlive.compile(...) looks like this:

  texlive.compile(code, root, function(pdf) {
    button.text('Compile');
    button.removeAttr('disabled');
    button.removeClass('disabled');

    $('#buttons #open_pdf').remove();
    $('#buttons').append('<button id="open_pdf" class="btn">Open PDF</button>').find('#open_pdf').click(function() { window.open('data:application/pdf;base64,'+window.btoa(pdf)); });
  });
});

changing texlive.compile(code, root, function(pdf) { [..] to texlive.compile(sty, root, function(pdf) { [..]

results in timeout of webbrowser.

Can you advise how to change this line code ?

manuels commented 11 years ago

duh, obviously it's the second argument (root) that must be changed. However, if the other *.sty files are found root should be fine.

Take a look at the GET media9.sty request. Is the file request at all? If so, check if it is successful, otherwise change the first element in

media9: [
  ['texlive/texmf-dist/tex/latex/media9/media9.sty', '/', 'media9.sty']
],

accordingly