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

How to go offline #194

Closed
brunetto opened this issue Feb 3, 2015 · 11 comments
Closed

How to go offline #194

brunetto opened this issue Feb 3, 2015 · 11 comments
Labels

Comments

@brunetto
Copy link

brunetto commented Feb 3, 2015

Hi!
Is there an easy guide on how to download everything to put it on a usb stick and go offline?
Or, how can I go offline? (mathjax included)

@junderhill
Copy link
Contributor

This is fairly easy to do, the following steps should do this..

  1. Download the latest release of remark
  2. Copy the remark.min.js file from the out directory into your presentation directory
  3. Update your html file to point the script src for remark to the local file such as <script src="remark.min.js">
  4. Go to http://www.google.com/fonts and find the three required font families adding them to your collection. You can then click 'USE' on the collection and click the download link.

2015-03-06 09_33_17-google fonts

2015-03-06 09_33_30-google fonts

  1. Copy the required .ttf files to the presentation directory
  2. Update the style element in the presentation html file to import the fonts. Notice the change to @font-face instead of import.

Your presentation HTML file will look something like this:

<!DOCTYPE html>
<html>
  <head>
    <title>Title</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <style type="text/css">
      @font-face{
        font-family: 'Droid Serif';
        src: url('DroidSerif.ttf');
      }
      @font-face{
        font-family: 'Yanone Kaffeesatz';
        src: url('YanoneKaffeesatz-Regular.ttf');
      }
      @font-face{
        font-family: 'Ubuntu Mono';
        src: url('UbuntuMono-Regular.ttf');
      }

      body { font-family: 'Droid Serif'; }
      h1, h2, h3 {
        font-family: 'Yanone Kaffeesatz';
        font-weight: normal;
      }
      .remark-code, .remark-inline-code { font-family: 'Ubuntu Mono'; }
    </style>
  </head>
  <body>
    <textarea id="source">

class: center, middle

# Title

---

# Agenda

1. Introduction
2. Deep-dive
3. ...

---

# Introduction

    </textarea>
    <script src="remark.min.js">
    </script>
    <script>
      var slideshow = remark.create();
    </script>
  </body>
</html>

My directory for the presentation now looks like this:

2015-03-06 09_32_19-test

@brunetto
Copy link
Author

brunetto commented Mar 6, 2015

Thanks!! Do I have to download also mathjax isn't it?

@junderhill
Copy link
Contributor

Not that I can see, there's not references to it from the remark.js source and a quick test of the above seems to work fine. Where is that library mentioned? I don't recall seeing it anywhere.

@brunetto
Copy link
Author

brunetto commented Mar 6, 2015

I need it to show equations in the presentations...

Here there's the wiki page and this is what I put at the end of the html file

    <script src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML&delayStartupUntil=configured" type="text/javascript"></script>
    <script type="text/javascript">
    var slideshow = remark.create({
    sourceUrl: './GM11.md',
});
        // Setup MathJax
        MathJax.Hub.Config({
            tex2jax: {
            inlineMath: [ ['$','$'], ["\\(","\\)"] ],
            skipTags: ['script', 'noscript', 'style', 'textarea', 'pre'],
            extensions: ["AMSmath.js", "AMSsymbols.js", "autobold.js"]
            }
        });
        MathJax.Hub.Queue(function() {
            $(MathJax.Hub.getAllJax()).map(function(index, elem) {
                return(elem.SourceElement());
            }).parent().addClass('has-jax');
        });

        MathJax.Hub.Configured();
    </script>

Probably I just need to figure out from the Mathjax site how to do this.

@junderhill
Copy link
Contributor

Ah ok, I would download the MathJax.js file to the presentation directory, update the script tag src to use the local one leaving the query string parameters.. Something like:

<script src="MathJax.js?config=TeX-AMS_HTML&delayStartupUntil=configured" type="text/javascript"></script>

@brunetto
Copy link
Author

brunetto commented Mar 6, 2015

ok, thanks!!
I'll try asap.

b

@spitters
Copy link

Thanks for the nice piece of software.
Unfortunately, just downloading Mathjax.js does not work for me.

I get strangely enough. It renders correctly, but after a few seconds I get:

[Math Processing Error]

Any ideas?

PS: are long subscripts supposed to be supported?

$$x_{n+1}$$

@spitters
Copy link

It looks like a need a number of files:

fontdata.js -> jax/output/HTML-CSS/fonts/STIX/STIX/fontdata.js
jax.js -> jax/output/HTML-CSS/jax.js
MathJax.js
MathMenu.js
MathZoom.js
remark-latest.min.js
TeX-AMS_HTML.js

However, it is still unpredictable. I'll report if I have a complete solution. Meanwhile help would be appreciated.

@spitters
Copy link

There is also:
jax/output/HTML-CSS/fonts/STIX/STIX/fontdata-extra.js

Looks like installing the mathjax debian packages did the trick.

@HenrikBengtsson
Copy link

Thanks for this information in this issue; my interest in offline presentation is because I don't want to assume that I'll have internet access in the moment I'm starting my presentation (sure, it's actually when I load the presentation, but still too risky).

A small FYI, If you use markdown-to-slides (>= 1.0.3; April 2016) to compile Markdown to HTML, it includes the content of remark.js in the generated HTML as:

markdown-to-slides --include-remark slides.md -o slides.html

It's also worth mentioning https://github.com/TalAter/UpUp, which provides generic offline caching of any website content. I haven't tried it, so I don't know how much work it is to get it working with Remark and whether it is possible to use locally (i.e. not sure if HTTPS server is needed). Just my two cents.

@Alexander-Barth
Copy link

If you need italic or bold fonts you also need to add this:

      @font-face{
        font-family: 'Droid Serif';
        src: url('Fonts/DroidSerif-Bold.ttf');
        font-weight: bold;
      }

      @font-face{
        font-family: 'Droid Serif';
        src: url('Fonts/DroidSerif-Italic.ttf');
        font-style: italic;
      }

      @font-face{
        font-family: 'Droid Serif';
        src: url('Fonts/DroidSerif-BoldItalic.ttf');
        font-weight: bold;
        font-style: italic;
      }

My fonts are in the Fonts folder. Of you need also the oblique variant you need to add them too. More info is available at http://stackoverflow.com/a/28571625.

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

No branches or pull requests

6 participants