Showing posts with label Google Docs. Show all posts
Showing posts with label Google Docs. Show all posts

How to write a Math or Data Science eBook?


When studying, I like to take notes, usually, I do it on my Blog, but often I use Jupyter notebooks which I commit to GitHub. If I am writing a paper I use Google Docs. Having my writing in 3 different places is not optimal. 
On top of that, using math formulas complicates things as it is not supported everywhere.

Example of a formula written using LaTeX:

$$ LogLoss = - \frac{1}{n} \sum_{i=1}^{n}
( y_i \cdot log(\hat{y_i}) + ( 1 - y_i ) \cdot \log(1 - \hat{y_i}) ) $$

So, how should I write a Math, or a Data Science, eBook?

First, publishing papers as PDF is most common, I read tons of them, but they are hard to digest unless you print them, or view them on a big screen. I do not want to sit in front of the computer any longer than I already do.  I like using Kindle reader, so an eBook format is much more user-friendly. I can set font sizes, and spacing, take notes, etc. The PDFs on Kindle are a really bad experience. Also, I would like to distribute my papers over the Amazon Kindle store (for free or not). Not everyone has a university or a work subscription to access papers on ieee.org, sciencedirect.com, proquest.com, etc.




Below, I will investigate different approaches and hopefully, come to a good conclusion.

How to send documents to Kindle:
  • Every Kindle account has an associated (secret) email, you can attach a file to it and it will show in your Kindle.
  • Make sure the file name is human-readable!
  • HTML (export from Jupyter Lab) sent to Kindle:
    • PRO:
      • it is readable, good for text-only pages
    • CON:
      • LaTeX is not converted to math formulas
      • Images are missing
  • PDF (of the same HTML) sent to Kindle:
    • PRO:
      • images show up
      • LaTeX formulas show up
      • good enough to publish a "paper"
    • CON:
      • still the problem with PDF in general -- no font size adjustment
  • ePUB (of the same HTML) sent to Kindle:
    • conversion is done with convertio.co
      • PRO
        • font adjustable
        • plots included
      • CONS:
        • missing images
        • LaTeX not converted to math formulas 
    • conversion with  calibre-ebook.com

Is Blogger (Blogspot) good for writing papers and articles?

Pro:
  • searchable 
  • easy to manage and edit
  • use of tags (labels) for finding related articles
  • support for LaTeX math notation
Cons: 
  • No good ways to "clean" export to ePub, PDF, or Markdown
    • I could write embedded JavaScript in Blogger that creates "print" version of article text only

Using Jupyter Notebook

Pro:

  • inline and current code (Julia, Python)
  • incline and current plots 
  • export to HTML, PDF, Markdown with pandoc.org/
Cons
  • no spellcheck while writing (Grammarly)
    • conda install -c conda-forge jupyterlab-spellchecker
  • GitHub Diff is garbage

How to install brew?

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

How to install pandoc? 

[see reference 5]
brew install pandoc


[see reference 1]


Using Markdown

Pros:

  • GitHub diff is readable


Using Google Docs

Pros:

  • Available on all devices, online and offline


[see reference 2]



References

  1. https://towardsdatascience.com/transform-jupyter-notebook-to-an-ebook-ef3a9d32ac4f
  2. https://workspace.google.com/marketplace/app/autolatex_equations/850293439076
  3. https://tug.org/mactex/mactex-download.html
  4. https://nbconvert.readthedocs.io/en/latest/install.html#installing-tex
  5. https://pandoc.org/installing.html



As an Amazon Associate I earn from qualifying purchases.

Embedding a GoogleDoc as a iframe in a BlogSpot.com post

Today, I decided to organize my writings, and since I find Google Docs the best way to compose, I was looking for a way to "PUBLISH" them in another way than ePubs.

Google Docs page has two options: to publish the whole document, hosted by docs, and EMBED the document on another website, in my case uki.BlogSpot.com




Embedding uses the <iframes> [horror music playing in the background].

The <iframes>, people have been hating them since the '90s, yet we are still using them.

I have spent an embarrassingly long time (ashamed to mention how long) trying every HTML attribute combination with width, height, <DIV>, and multiple JavaScript replacement and resize methods. 

All of them failed. 

Finally, I went back to my experience circa 1999  @ RollingStone.com and said, if everything else fails, put it in the TABLE grid and format the grid to your liking. It worked just how I wanted. 
 



I posted the solution on Stackoverflow.com as no one reads my blog: https://stackoverflow.com/a/72750122/6312771


<table width="100%" height="800px" border="0"> <tr> <td> <iframe src="https://docs.google.com/document/d/e/2PACX-1vTaRY68GO9FWHU8K64bqGUVD1V_FKxKqlpeeEBT44UZvwe_vi62hDh-yJM5bKPrDR6B-a96BeRTzejx/pub?embedded=true" frameborder="0" height="100%" width="100%"> </iframe> </td> </tr> </table>


Here is the result, please let me know if this helped you.


 



As an Amazon Associate I earn from qualifying purchases.

Embedding a GoogleDoc as a iframe in a BlogSpot.com post

Today, I decided to organize my writings, and since I find Google Docs the best way to compose, I was looking for a way to "PUBLISH" them in another way than ePubs.

Google Docs page has two options: to publish the whole document, hosted by docs, and EMBED the document on another website, in my case uki.BlogSpot.com




Embedding uses the <iframes> [horror music playing in the background].

The <iframes>, people have been hating them since the '90s, yet we are still using them.

I have spent an embarrassingly long time (ashamed to mention how long) trying every HTML attribute combination with width, height, <DIV>, and multiple JavaScript replacement and resize methods. 

All of them failed. 

Finally, I went back to my experience circa 1999  @ RollingStone.com and said, if everything else fails, put it in the TABLE grid and format the grid to your liking. It worked just how I wanted. 
 



I posted the solution on Stackoverflow.com as no one reads my blog: https://stackoverflow.com/a/72750122/6312771


<table width="100%" height="800px" border="0">
<tr>
<td>
<iframe src="https://docs.google.com/document/d/e/2PACX-1vTaRY68GO9FWHU8K64bqGUVD1V_FKxKqlpeeEBT44UZvwe_vi62hDh-yJM5bKPrDR6B-a96BeRTzejx/pub?embedded=true"
frameborder="0"
height="100%"
width="100%">

</iframe>
</td>
</tr>
</table>


Here is the result, please let me know if this helped you.


 



As an Amazon Associate I earn from qualifying purchases.

One year later

It has been almost a year since I wrote anything besides technology articles on my blog.

It may be related to the fact that I have not read any real books, which is unlike me, considering the thousands of books I own. 

I do read every day and study a lot. 

I make good use of YouTube, but somehow, I have lost my drive for writing.  

I have been trying to decide what platform to use for writing, such as Blogger, Medium.com, Google Docs, etc. I have several documents (books) started, but I fear they will never see the light of day. 

On the other hand, blogs feel eclectic and irrelevant. Nevertheless, here I am writing this.

I am writing tonight with the lights out, using my large Android tablet and a pen stylus, and I must say it is fast and flawless. 

Let's hope I can get back to writing as a habit. Maybe these blog notes will become material for a book someday.



As an Amazon Associate I earn from qualifying purchases.

Tools for Writing This Book

After trying several writing software tools,
we found it frustrating that only Google Docs allowed online real-time sharing between multiple reviewers and various devices.
Even with Google Docs, editing on the tablet is far from satisfactory.

When we are "on the go", the Twitter, Facebook and recently Google+ to be useful repository of our thoughts, Uki maintains a saying:

“I’m writing an books 140 characters at a time.”
Finally, we decided to write our thoughts down as blog posts.



As an Amazon Associate I earn from qualifying purchases.

apt quotation..