Chapter 2 Author

In this chapter, we explain how to publish books written by an author on her personal computer to MathPage. We assume she can run commands in a Linux terminal.

Section 1 Preparation for Publishing

Open a terminal. On Windows, run Ubuntu app from the start menu installed on WSL.
Install a script
Download the file
mp
and make it executable.1 On Windows, you may need to open the Linux folder by the command explorer.exe .(don’t forget the last period). Then go to the folder containing the downloaded file, run the command
ls
to check the file mp. Finally run
    chmod 755 mp
and place it in a path that can be reachable from anywhere.
Register ssh key
To publish a book to MathPage, you have to register your ssh key. In terminal, go to
.ssh
folder under your home folder. If the folder does not exist, create it first.2 Note that a directory or a file whose name starts with a dot is not visible by the command
ls
.
Use the following command to create private key
mathpage
and public key
mathpage.pub
:
    ssh-keygen -f mathpage
Display the content of the public key by
    cat mathpage.pub
and copy and paste the content as your ssh key to the author menu “Author > Manage ssh key” in MathPage.
Prepare passfile
Use the following command to create
.mathpage
folder under the home folder
    cd ~
    mkdir .mathpage
Before proceeding, note that in
passfile
,
AUTHOR
is the login id of the author,
SHELF
is the path to the folder containing LaTeX source files,
KEY
is the path to the ssh public key prepared before, and
PUBLISHER
is fixed.
Now create
passfile
using the command
    cd .mathpage
    cat > passfile
and paste the following content
    PUBLISHER=mathpage@publisher.mathpage.dev
    AUTHOR=judy
    SHELF=~/shelf/
    KEY=~/.ssh/mathpage
into it and press
CTRL-D
to save it. To verify the content of
passfile
, run the command
    cat passfile
again.
Finally, make sure the folder
~/shelf
used in
SHELF
above actually exists. To create the folder, use the command
cd ~; mkdir shelf
.
Upload LaTeX source files
To upload files in
SHELF
, use the command
    mp publish
(or
./mp publish
in the folder in which the file
mp
is). Now the script uploads the files in
SHELF
to MathPage and starts publishing updated books.
If you changed the name or location of
passfile
, then use the command
    mp -p ~/.mathpage/passfile publish
with changed path to
passfile
.
1
Edge or Safari web browser may have renamed the downloaded file as mp.txt. In this case, change to the original name mp.
2
mkdir .ssh; cd .ssh

Section 2 Author Menu

Manage author info
“First name” and “Last name” are used to display the copyright owner of the books published in MathPage. On the other hand, “Nickname” is the pen name of the author. “Language” is the language which is used, for instance, in emails to the author.
Manage ssh key
Here paste into the text area the content of the ssh key generated in the publishing preparation step. Whenever the ssh key changes, the field should be updated with the content of the new ssh key.
Manage books
Add a new book by filling “Title“, “Cover”, “Slug” and choosing the main LaTeX source file in the “Source” field. For “Title”, an image file can be uploaded. If there is no image file ready, then this field can be left empty. “Slug” is a short character string used in the url of the book, and hence comprised of English characters from a to z, numerals from 0 to 9, an hyphen or a dash. For example, for a linear algebra book, you can use the acronym “la” for slug. For “Language”, English or Korean can be chosen as the language of the book. If the book is comprised of several files “
\included
” to the main file, then in “Source”, choose the main file.
Open my bookshelf
In the bookshelf, the books published in MathPage are displayed. This page is only visible to the author.
Request for sale
The author with the copyright of a book published in MathPage can request sale of the book in the MathPage bookstore. Use “Request for Sale” button in the author menu.

Section 3 Publishing Tutorial

Using LaTeX
Create a new folder
my_book
in the shelf folder. Then download to the folder the file
Typeset this file by the LaTeX system on the personal computer. If typeset successfully, then open and check the generated
my_book.pdf
file.
Now open the terminal, and run the command
mp publish
to upload the files to MathPage. Then in the author menu, add a new book
My Book
, and check the published book in MathPage.
Publishing in Korean using XeLaTeX
A book in Korean can be typeset by XeLaTeX engine. Create a new folder
my_book_ko
in the shelf folder. Into the new foler, download one of the following files for your platform
Typeset this file using XeLaTeX engine (in the LaTeX system). After typesetting, check the generated
my_book_ko.pdf
.
Now use the command
mp publish
to publish to MathPage. In the author menu, create a new book
My Korean Book
. Choose Korean as the language of the book. Finally check the new book in MathPage.
Using a Korean book class file
If you look into the book
my_book_ko.pdf
carefully, you would find English expressions such as “Chapter” or “Section” unfit in the book in Korean language. This is because of the document class file
book.cls
, which is designed for English books. Hence for books in Korean, download the following file to the folder containing the book source files
and change the first line of
my_book_ko.tex
as follows:
\documentclass{book-ko}
  
Now typeset the book with XeLaTeX again, and check
my_book_ko.pdf
in natural Korean style.
Writing in LaTeX
A large subset of LaTeX is supported by MathPage. On the other hand, MathPage extends LaTeX to support media and interactive contents. Refer to Chapter 5 for further information.