1. Requirement
-
You need a google account to work with GoogleDocs
2. Get Started
-
Create a new document in GoogleDocs https://docs.google.com/
-
Share the document with docs.iac.ethz.ch@gmail.com
-
Go to https://docs.iac.ethz.ch and type in the ID of your GoogleDocs document
-
As a starting point check out the source code of this document
The ID of your GoogleDocs document (a random 45 characters long string) is encoded into the URL: https://docs.google.com/document/d/1LAY60C4Dy0EzetXDEjPav9axy6JpQOey3pXTJa1IYag/ |
The converter on the server runs every 5 minutes. Therefore your changes are not immediately visible! |
3. Write AsciiDoc for AsciiDoctor
-
AsciiDoctor User Manual: https://docs.asciidoctor.org/asciidoc/latest
-
AsciiDoc Syntax Quick Reference: https://docs.asciidoctor.org/asciidoc/latest/syntax-quick-reference
-
AsciiDoc Writer’s Guide: https://asciidoctor.org/docs/asciidoc-writers-guide
Not all AsciiDoc features are supported by AsciiDoctor |
4. Images
-
Remote images can be included with a link
image::https://asciidoctor.org/images/octocat.jpg[GitHub mascot]
-
Alternatively, images can be uploaded over FTP. You find your link in the form of ftp://username:password@docs.iac.ethz.ch here https://docs.iac.ethz.ch/google/<YOUR_ID>/. The files will be uploaded in a folder called upload. Therefore you have to include upload in the path
image::upload/sunset.jpg[Image of a Sunset]
See https://docs.asciidoctor.org/asciidoc/latest/macros/images for more info |
Directly supported are jpg and png-images. In case you upload ps, eps or pdf-images, they will be converted to png-images. Therefore you have to refer to the png-image in your asciidoc. For example, if you upload figure.ps write
image::upload/figure.png[]
Supported image formats are png, jpg, ps, eps and pdf. |
5. Formulas
-
latexmath or stem is supported
latexmath:[a^2+b^2=c^2]
stem:[sqrt(4) = 2]
6. Include Documents
In order to include another document use the META-tag include
where <ID> is the google ID of the included document.
7. References
Adding references from a bibtex file to an asciidoc file can be done using the META-tag bib
Some examples:
-
The bibtex file containing the bibliography has to be stored in a google document with <ID>
-
<style> defines the reference style. The default style is 'apa'. All styles available through CSL https://github.com/citation-style-language/styles are supported. For more info about the styles see Zotero Style Repository: https://www.zotero.org/styles
-
See https://notabug.org/peterlane/asciidoc-bib for how to include citations and bibliography in your text
-
The reference list will be included in your document with the line:
[bibliography]
8. Numbering
-
Chapters respectively sections will be automatically numbered if you add to your document the line
:numbered:
-
Tables and figures will be automatically numbered if you use META tag num and placeholders #numtab and #numfig. Add to your document the line
-
Per default offset is equal 0, i.e. the first chapter will be chapter 1. If needed, you can define an offset. For example, with offset -1 the first chapter will be chapter 0.
-
Numbering of figures with #numfig: All #numfig will be replaced by continuous numbers. For example
[[fig-name, Figure #numfig]] image::upload/figure.png[caption="Figure #numfig. ",title="My figure"]
Referring to figure 'fig-name' can be done like that:
For more information see <<fig-name>>.
-
Numbering of tables with #numtab works the same way.
9. Summary
Using the META-tag summary will create a summary of your document in a separate file (html and pdf). All paragraphs between
.Summary **** text .. text text .. text ****
will be collected and merged into the summary. The META-tags are
The document defined after summaryhead will be added at the beginning of the summary. The document defined after summarytail will be appended to the summary.
10. PDF Options
-
To add a header to your PDF use the META-tag pdfheader
11. Debugging
-
In case something goes wrong, log files can be found here https://docs.iac.ethz.ch/google/<YOUR_ID>/log
12. Behind the Scenes
-
Files are converted to HTML using asciidoctor (https://asciidoctor.org/)
-
Files are converted to PDF using wkhtmltopdf (https://wkhtmltopdf.org/)
-
References are included using asciidoc-bib (https://notabug.org/peterlane/asciidoc-bib)
-
Gdrive command line utility is used for interacting with Google Drive (https://github.com/prasmussen/gdrive)
-
Ghostscript and ImageMagick are used to convert images