File install/manual.md added (mode: 100644) (index 0000000..7a81db6) |
|
1 |
|
--- |
|
2 |
|
title: Instruction Manual |
|
3 |
|
--- |
|
4 |
|
|
|
5 |
|
<!--- |
|
6 |
|
To compile this document: |
|
7 |
|
Scroll down to Compiling and Converting the Document-- choose either command (HTML, ODT, PDF), change 'example' file to 'manual' and follow instructions from there. |
|
8 |
|
--> |
|
9 |
|
|
|
10 |
|
*Overview* |
|
11 |
|
*The Generating Documents (Basic) Using Markdown User Manual outlines |
|
12 |
|
the objectives, requirements, and needs to be addressed when training |
|
13 |
|
users on how to generate a PDF, HTML, or ODT document using markdown |
|
14 |
|
file. The plan presents the activities needed to support file |
|
15 |
|
development.* |
|
16 |
|
|
|
17 |
|
# Introduction |
|
18 |
|
|
|
19 |
|
Markdown is a fast and easy way to take notes, create content for a website, and produce print-ready documents. It's a lightweight markup language with plain text formatting syntax. Markdown is designed to be converted to many different output formats such as PDF, Word, ODT, HTML, and many more. It is both portable and platform independent, more intuitive to read and write, and can be used for websites, documents, notes, books, etc., but is often used to format readme |
|
20 |
|
files and in online discussion forums. |
|
21 |
|
|
|
22 |
|
## How Does Markdown Work? |
|
23 |
|
|
|
24 |
|
Markdown text is written and stored in plaintext file with a markdown extension (e.g. .md). Using a separate markdown application capable of processing markdown (we will be using Pandoc), it takes the markdown formatted text and converts it to HTML. The HTML file can then be viewable in a web browser or then converted to another file format, like PDF. |
|
25 |
|
|
|
26 |
|
{ height=50% } |
|
27 |
|
|
|
28 |
|
|
|
29 |
|
|
|
30 |
|
# Requirements |
|
31 |
|
|
|
32 |
|
|
|
33 |
|
## Skills required |
|
34 |
|
|
|
35 |
|
|
|
36 |
|
* Markdown |
|
37 |
|
* For a basic tutorial visit: <https://commonmark.org/help/tutorial/> |
|
38 |
|
|
|
39 |
|
Helpful Skills: |
|
40 |
|
|
|
41 |
|
* LaTex code |
|
42 |
|
* Common terminal commands |
|
43 |
|
* For more information visit: <https://www.dummies.com/computers/macs/mac-operating-systems/how-to-use-basic-unix-commands-to-work-in-terminal-on-your-mac/> |
|
44 |
|
* Pandoc's Markdown |
|
45 |
|
* For more information visit: <https://pandoc.org/MANUAL.html#pandocs-markdown> |
|
46 |
|
* YAML (YAML Ain't Markup Language) |
|
47 |
|
* For more information visit: <https://blog.stackpath.com/yaml/> |
|
48 |
|
|
|
49 |
|
## Software Requirements |
|
50 |
|
|
|
51 |
|
For a fully functioning environment and step by step guide on installation instructions follow the instructions below: |
|
52 |
|
|
|
53 |
|
NOTE: All the following steps must be installed on a Linux operating system. |
|
54 |
|
|
|
55 |
|
1) Install [Git](https://github.com) |
|
56 |
|
In your terminal, type (as root): `apt update` |
|
57 |
|
then type: `apt install git` |
|
58 |
|
|
|
59 |
|
NOTE: Upon opening your terminal, you may see username@hostname:~$. You want your terminal to run as root@hostname. To do this, upon opening your terminal, type: `su --` |
|
60 |
|
|
|
61 |
|
Then enter your password. You should see something like this: |
|
62 |
|
|
|
63 |
|
\ |
|
64 |
|
|
|
65 |
|
2) Install [Make](https://gnu.org/software/make/manual/make.html) |
|
66 |
|
In your terminal, type (as root): `apt-get update` |
|
67 |
|
then type: `apt-get install build-essential` |
|
68 |
|
|
|
69 |
|
3) Install [LaTex](https://latex-project.org) |
|
70 |
|
* Download |
|
71 |
|
[install-tl-unx.tar.gz](http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz) |
|
72 |
|
from <https://www.tug.org/texlive/acquire-netinstall.html> |
|
73 |
|
* Extract the folder |
|
74 |
|
* In the terminal, navigate to the location of the extracted folder |
|
75 |
|
* In the terminal, type (as root): perl install-tl |
|
76 |
|
* When prompted, enter command: `I` |
|
77 |
|
|
|
78 |
|
4) Install [Python 3](https://python.org/download/releases/3.0/) |
|
79 |
|
In your terminal type (as root): `apt-get install python3-pip` |
|
80 |
|
|
|
81 |
|
5) Install [Pandoc](https://pandoc.org) |
|
82 |
|
* Download [[pandoc-2.9.1.1-1-amd64.deb]{.underline}](https://github.com/jgm/pandoc/releases/download/2.9.1.1/pandoc-2.9.1.1-1-amd64.deb) from <https://github.com/jgm/pandoc/releases/tag/2.9.1.1> |
|
83 |
|
* From your terminal navigate to location of the downloaded Pandoc folder (most likely the downloads folder) and type: `dpkg -i pandoc-2.9.1.1-1-amd64.deb` |
|
84 |
|
|
|
85 |
|
6) Install [pandoc-include-code](https://github.com/owickstrom/pandoc-include-code) filter |
|
86 |
|
* In your terminal (as normal user) type: `cabal update` |
|
87 |
|
* (cabal is a system for building and packaging Haskell libraries and programs. If cabal command not found then type (as root)): |
|
88 |
|
`apt-get install haskell-platform` |
|
89 |
|
* Then, (as normal user) type: `cabal update` |
|
90 |
|
|
|
91 |
|
NOTE: To run terminal as a normal user, type: `su - username` where "username" is your username. You should see something like this: |
|
92 |
|
|
|
93 |
|
\ |
|
94 |
|
|
|
95 |
|
* Then type: `cabal install pandoc-types` |
|
96 |
|
* Go to <https://github.com/owickstrom/pandoc-include-code> and download the repository by clicking "Download ZIP" and extract the folder |
|
97 |
|
* In your terminal, navigate to the extracted folder |
|
98 |
|
* In your terminal type: `cabal configure` |
|
99 |
|
* Then type: `cabal install` |
|
100 |
|
|
|
101 |
|
7) Install [pandoc-numbering](https://github.com/chdemko/pandoc-numbering) filter |
|
102 |
|
Type (as normal user): `pip3 install pandoc-numbering` |
|
103 |
|
|
|
104 |
|
8) Install [latexmk](https://mg.readthedocs.io/latexmk.html) fully automated latex document generation |
|
105 |
|
* Go to <https://ctan.org/pkg/latexmk/> |
|
106 |
|
* Click download link and download and extract the file. |
|
107 |
|
* Open the extracted latexmk folder, locate the "latexmk.pl" file and move it to "~/.local/bin" and rename it to "latexmk". |
|
108 |
|
|
|
109 |
|
NOTE: You may need to expose hidden files while in "Home". To do this press Ctrl + H. |
|
110 |
|
|
|
111 |
|
9) Install [pdf2svg](https://github.com/dawbarton/pdfsvg) |
|
112 |
|
In your terminal type (as root): `apt-get install pdf2svg` |
|
113 |
|
|
|
114 |
|
10) Install [librsvg2-bin](https://github.com/teemu/librsvg2-bin) |
|
115 |
|
In your terminal type (as root): `apt-get install librsvg2-bin` |
|
116 |
|
|
|
117 |
|
11) Install [texlive-xetex](https://packages.debian.org/sid/tex/texlive-xetex) |
|
118 |
|
In your terminal type (as root): `apt-get install texlive-xetex` |
|
119 |
|
|
|
120 |
|
12) Install linuxlibertine font and freefont |
|
121 |
|
* In your terminal type (as root): `apt-get install fonts-linuxlibertine` |
|
122 |
|
* Then type: `apt-get install fonts-freefont-ttf` |
|
123 |
|
|
|
124 |
|
13) Clone this [basic folder structure](https://github.com/poonamveeral/GeneralRepo) (as a normal user) |
|
125 |
|
Type: `git clone https://github.com/poonamveeral/GeneralRepo` |
|
126 |
|
|
|
127 |
|
14) Testing Pandoc |
|
128 |
|
* In your terminal, navigate to Course/install |
|
129 |
|
* In your terminal type: `pandoc test_pandoc.md -o test_pandoc.html` |
|
130 |
|
* In the install folder, you should see a file called "test_pandoc.html" |
|
131 |
|
|
|
132 |
|
15) Testing pandoc-numbering |
|
133 |
|
* In the same install folder, type: |
|
134 |
|
|
|
135 |
|
`pandoc test_pandoc-numbering.md --filter pandoc-numbering -o test_pandoc-numbering.html` |
|
136 |
|
|
|
137 |
|
* If you're receiving errors, in your terminal, type: |
|
138 |
|
`export PATH=$PATH:/home/username/.local/bin` |
|
139 |
|
* In the install folder, you should see a file called "test_pandoc-numbering.html" |
|
140 |
|
|
|
141 |
|
16) Test pandoc-citeproc |
|
142 |
|
* In the same install folder, type: |
|
143 |
|
|
|
144 |
|
`pandoc --filter pandoc-citeproc test_pandoc-citeproc.md -o test_pandoc-citeproc.html` |
|
145 |
|
|
|
146 |
|
* In the install folder, you should see a file called |
|
147 |
|
"test_pandoc-citeproc.html" |
|
148 |
|
|
|
149 |
|
17) Test pandoc-include-code |
|
150 |
|
* In the same install folder, type: |
|
151 |
|
`pandoc --filter pandoc-include-code -o test_pandoc-include-code.pdf test_pandoc-include-code.md` |
|
152 |
|
* In the install folder, you should see a file called "test_pandoc-citeproc.html" |
|
153 |
|
|
|
154 |
|
If you're receiving "Could not find executable pandoc-include-code" |
|
155 |
|
|
|
156 |
|
* Go to the root folder, and open the ".bashrc" file with a text editor |
|
157 |
|
* Add the line below to the bottom of the file and click "save" to save the file: |
|
158 |
|
|
|
159 |
|
`export PATH=$PATH:/home/username/.cabal/bin` |
|
160 |
|
|
|
161 |
|
# Creating the Document |
|
162 |
|
Follow these steps to learn how to create a simple markdown document utilizing bibliographies, images/figures, and code blocks. |
|
163 |
|
|
|
164 |
|
## Step 1 |
|
165 |
|
|
|
166 |
|
To start off, you're going to need a folder structure set up like this: |
|
167 |
|
|
|
168 |
|
\ |
|
169 |
|
|
|
170 |
|
|
|
171 |
|
If you completed number 13 from 2.2 Software Requirements skip step 2. If not, continue on. |
|
172 |
|
|
|
173 |
|
## Step 2 |
|
174 |
|
|
|
175 |
|
You want each folder to contain: |
|
176 |
|
|
|
177 |
|
```{.plain} |
|
178 |
|
. |
|
179 |
|
├── install/ -- How to install requirements to compile the document. |
|
180 |
|
│ └── .md files -- To test Pandoc |
|
181 |
|
├── bib/ -- References (including reference to the document). |
|
182 |
|
│ └── .bib files -- To store citations. |
|
183 |
|
├── code/ -- Source code included in the document. |
|
184 |
|
│ └── code files -- (E.g. .java, .xml, .sql) |
|
185 |
|
├── fig/ -- Source code for various figures used in the document. |
|
186 |
|
├── img/ -- Various image files itegrated in the document. |
|
187 |
|
├── latex/ -- Latex configuration file. |
|
188 |
|
├── style/ -- CSS style used for the web page. |
|
189 |
|
├── Makefile -- Directives to generate example.md document. |
|
190 |
|
├── README.md -- The present file. |
|
191 |
|
└── example.md -- Sample file to test. |
|
192 |
|
``` |
|
193 |
|
|
|
194 |
|
An example of a basic template of a markdown file can be found at "example.md" in the generic repo from step 13 from above. |
|
195 |
|
|
|
196 |
|
# Compiling and Converting the Document |
|
197 |
|
Follow these steps to learn how to compile and convert a markdown file to PDF, ODT, and HTML. Other possible conversion formats can be found here: <https://pandoc.org/> |
|
198 |
|
|
|
199 |
|
* Open up a terminal, inside of it, change your directory to where your markdown file is located. In this example, navigate to your "Course" folder. To do this, simply type: `cd Course` where "Course" is the name of your Course folder. |
|
200 |
|
|
|
201 |
|
* Next, type: `make fig` |
|
202 |
|
"make fig" compiles all the latex code in order to produce the figures from the figures folder. |
|
203 |
|
|
|
204 |
|
* Then type: `make fig_svg` |
|
205 |
|
"make fig_svg" compiles all the latex code in order to produce the figures from the figures folder. |
|
206 |
|
|
|
207 |
|
* To produce a PDF document common format is: |
|
208 |
|
|
|
209 |
|
`pandoc <filters> inputfile.md -o outputfile.ext` |
|
210 |
|
|
|
211 |
|
or |
|
212 |
|
|
|
213 |
|
`pandoc <filters> -o outputfile.ext inputfile.md` |
|
214 |
|
|
|
215 |
|
## PDF |
|
216 |
|
For our example, in your terminal, while in the directory of where your markdown file is located, which should be your "Course" folder, type: |
|
217 |
|
|
|
218 |
|
`make pdf` |
|
219 |
|
|
|
220 |
|
or |
|
221 |
|
|
|
222 |
|
``` |
|
223 |
|
pandoc --toc --filter pandoc-numbering --filter pandoc-citeproc --filter pandoc-include-code \ |
|
224 |
|
--top-level-division=chapter -M date="$(LANG=en_us_88591 date '+%B %e, %Y (%r)')" \ |
|
225 |
|
--pdf-engine=xelatex --pdf-engine-opt=-shell-escape -V links-as-notes \ |
|
226 |
|
--default-image-extension=pdf -o example.pdf example.md |
|
227 |
|
``` |
|
228 |
|
|
|
229 |
|
To check if the results worked, from your desktop, navigate to your "Course" folder. You should see a new file called "example.pdf". |
|
230 |
|
|
|
231 |
|
## ODT |
|
232 |
|
For our example, in your terminal, while in the directory of where your markdown file is located, which should be your "Course" folder, type: |
|
233 |
|
|
|
234 |
|
`make odt` |
|
235 |
|
|
|
236 |
|
or |
|
237 |
|
|
|
238 |
|
``` |
|
239 |
|
pandoc --toc --filter pandoc-numbering --filter pandoc-citeproc --filter pandoc-include-code \ |
|
240 |
|
--top-level-division=chapter -M date="$(LANG=en_us_88591 date '+%B %e, %Y (%r)')" \ |
|
241 |
|
--default-image-extension=svg -o example.odt example.md |
|
242 |
|
``` |
|
243 |
|
|
|
244 |
|
To check if the results worked, from your desktop, navigate to your "Course" folder. You should see a new file called "example.odt". |
|
245 |
|
|
|
246 |
|
|
|
247 |
|
## HTML |
|
248 |
|
For our example, in your terminal, while in the directory of where your markdown file is located, which should be your "Course" folder, type: |
|
249 |
|
|
|
250 |
|
`make html` |
|
251 |
|
|
|
252 |
|
or |
|
253 |
|
|
|
254 |
|
``` |
|
255 |
|
pandoc --toc --filter pandoc-numbering --filter pandoc-citeproc --filter pandoc-include-code \ |
|
256 |
|
--top-level-division=chapter -M date="$(LANG=en_us_88591 date '+%B %e, %Y (%r)')" \ |
|
257 |
|
--css=style/style.css --toc-depth=1 --self-contained --default-image-extension=svg \ |
|
258 |
|
-o example.html example.md |
|
259 |
|
``` |
|
260 |
|
|
|
261 |
|
where "style.css" is the name of your css file. |
|
262 |
|
|
|
263 |
|
To check if the results worked, from your desktop, navigate to your "Course" folder. You should see a new file called "example.html". |
|
264 |
|
|
|
265 |
|
|