|
1 | 1 | --- |
2 | | -title: "Using the learnlatex.org site (Chinese)" |
3 | | -permalink: /zh/help |
| 2 | +layout: "page" |
| 3 | +lang: "en" |
| 4 | +title: "Using the learnlatex.org site" |
| 5 | +description: "This page explains the learnlatex.org website itself and how to best make use of it." |
| 6 | +permalink: /en/help |
4 | 7 | --- |
5 | | -Translation to be added _after_ English text completed. |
| 8 | +<script> |
| 9 | + function acesettings() { |
| 10 | + editors['pre0'].execCommand("showSettingsMenu"); |
| 11 | + } |
| 12 | +</script> |
| 13 | + |
| 14 | +# Help |
| 15 | + |
| 16 | + |
| 17 | +## Navigating the site |
| 18 | + |
| 19 | +The course consists of 16 core lessons that can be reached from the |
| 20 | +[table of contents]({{ "/" | absolute_url | append: page.lang | append: "/#toc" }}) on the [start page](./). |
| 21 | + |
| 22 | +Each lesson has a link to one associated lesson on the same subject |
| 23 | +that goes into greater depth. It should be possible to work through |
| 24 | +all 16 lessons _without_ reading the additional lessons. |
| 25 | + |
| 26 | +At the end of the course there are one or more lessons specific to the |
| 27 | +language being used for the lessons, and finally a gallery of examples |
| 28 | +of packages demonstrating LaTeX use not covered by this course. |
| 29 | + |
| 30 | +--- |
| 31 | + |
| 32 | +## Examples |
| 33 | + |
| 34 | +### Running the examples |
| 35 | + |
| 36 | +Each example consists of a complete small LaTeX document shown within |
| 37 | +the page like this: |
| 38 | + |
| 39 | +```latex |
| 40 | +\documentclass{article} |
| 41 | +\usepackage[T1]{fontenc} |
| 42 | +
|
| 43 | +\begin{document} |
| 44 | +Example text. |
| 45 | +\end{document} |
| 46 | +``` |
| 47 | + |
| 48 | +Each example is complete. However you may wish to edit it to make small |
| 49 | +changes, perhaps as part of an Exercise set at the end of the lesson. |
| 50 | + |
| 51 | +The editor being used is [ACE](https://ace.c9.io/). |
| 52 | + |
| 53 | +You may customise the theme used in the editor (for example using a |
| 54 | +dark theme with light text on a dark background) on the [Site Settings](settings) page. |
| 55 | +A convenient way to experiment with different themes is to to use <kbd>Ctrl</kbd>+<kbd>,</kbd> (<kbd>⌘</kbd>+<kbd>,</kbd> on Mac) |
| 56 | +while on any example in the site. [This displays a panel](javascript:acesettings()) which allows you to change all the ACE settings. |
| 57 | + |
| 58 | +The ACE repository has a [useful page of editor keyboard shortcuts](https://github.com/ajaxorg/ace/wiki/Default-Keyboard-Shortcuts). |
| 59 | + |
| 60 | + |
| 61 | + |
| 62 | +#### Three ways to run the example |
| 63 | + |
| 64 | +* Use the Overleaf service |
| 65 | +* Use the TeXLive.net service |
| 66 | +* Use a locally installed TeX system |
| 67 | + |
| 68 | +##### Use the Overleaf service |
| 69 | + |
| 70 | +Overleaf is one of the most popular online LaTeX editing services. The |
| 71 | +<button>Open in Overleaf</button> button, below the example, will submit the |
| 72 | +code to [Overleaf](https://www.overleaf.com/about). |
| 73 | + |
| 74 | +If you do not have an account, or the account details are not |
| 75 | +already cached in your browser, then you will be redirected to a |
| 76 | +login page where you may login or register with Overleaf. This is a |
| 77 | +free service but does require you to give some details and agree to |
| 78 | +terms and conditions. |
| 79 | + |
| 80 | +If your Overleaf account is already cached in your browser, then |
| 81 | +Overleaf will be opened in a new tab, with a new |
| 82 | +project with the code. You may then edit it in |
| 83 | +Overleaf which will simultaneously run LaTeX on your code showing |
| 84 | +the resulting output or error log. |
| 85 | + |
| 86 | +Unlike documents processed at TeXLive.net, you may save your project |
| 87 | +in your Overleaf account and return to it later. |
| 88 | + |
| 89 | +##### Use the TeXLive.net service |
| 90 | + |
| 91 | +The <button>Run at TeXLive.net</button> button, below the example, will submit the code to the |
| 92 | +[TeXLive.net](https://texlive.net) service[^1]. |
| 93 | + |
| 94 | +The TeXLive.net service was developed specifically to support this site, and |
| 95 | +in particular makes use of [PDF.js](https://mozilla.github.io/pdf.js/) |
| 96 | +to enable display of PDF on mobile and other browsers without built in PDF |
| 97 | +readers. |
| 98 | + |
| 99 | +The resulting PDF document (or section of the error log) will be |
| 100 | +shown inline immediately below the example. A <button>Delete |
| 101 | +Output</button> button will be provided so that you may remove this output |
| 102 | +(or you may leave it in place and continue the rest of the lesson |
| 103 | +below). |
| 104 | + |
| 105 | +Note that **TeXLive.net** requires no login or signup of any sort |
| 106 | +so it is very convenient for small examples, but this site |
| 107 | +provides no mechanism to save your document. Any changes that you |
| 108 | +make to the example are lost if you move off the page. |
| 109 | + |
| 110 | +##### Locally installed TeX system |
| 111 | + |
| 112 | +If you have a TeX system installed locally, then you may copy the |
| 113 | +example code off the page, either explicitly selecting it, or by |
| 114 | +using select all keyboard shortcuts in the editor |
| 115 | +(<kbd>Ctrl</kbd>+<kbd>A</kbd> <kbd>Ctrl</kbd>+<kbd>C</kbd> |
| 116 | +in windows for example). This will place the code in your operating system |
| 117 | +clipboard so you can start a blank document using your local |
| 118 | +editor, and paste in the text. |
| 119 | + |
| 120 | +### Troubleshooting |
| 121 | + |
| 122 | +Our examples are based around using an up-to-date LaTeX installation. They all |
| 123 | +work with both of our online demonstration systems, so if you get errors with |
| 124 | +the examples we provide, you might want to check if your LaTeX system is |
| 125 | +up-to-date. |
| 126 | + |
| 127 | +--- |
| 128 | + |
| 129 | +## Choosing the TeX engine |
| 130 | + |
| 131 | +When submitting example documents, by default the `pdflatex` engine will be used. |
| 132 | + |
| 133 | +You can force the choice of `latex`, `pdflatex`, `xelatex`, `lualatex`, |
| 134 | +`platex` or `uplatex` by using a comment of the form: |
| 135 | + |
| 136 | +`% !TEX ` _any text_ `lualatex` |
| 137 | + |
| 138 | +where the white space at the start is optional and case is ignored as |
| 139 | +is _any text_ between the first and last word. |
| 140 | + |
| 141 | +This allows the form `% !TEX program=pdflatex` used by some TeX editors |
| 142 | +but does not require the `program=` and is currently restricted to |
| 143 | +specifying just one of the engines that are supported on |
| 144 | +the online systems being used. |
| 145 | + |
| 146 | +You can see an example of a comment being used to specify LuaLaTeX in |
| 147 | +[some of the examples on this site](more-14). |
| 148 | + |
| 149 | +If `platex` or `uplatex` is specified; then the `dvipdfmx` program is |
| 150 | +also used to produce the PDF result from the DVI file that these variants generate. |
| 151 | +Similarly `dvips` and `ps2pdf` are used if `latex` is specified. |
| 152 | + |
| 153 | +If the engine is not specified in a `% !TeX` comment, then `pdflatex` will be used |
| 154 | +unless you have specified a default TeX engine on the [Site Settings](settings) page. |
| 155 | + |
| 156 | +--- |
| 157 | + |
| 158 | +## Choosing how to display the output |
| 159 | + |
| 160 | +If you use the TeXLive.net system, then the PDF |
| 161 | +output from running an example is shown using |
| 162 | +[PDF.js](https://mozilla.github.io/pdf.js/) by default. This provides |
| 163 | +consistent behavior over the widest range of browsers. |
| 164 | + |
| 165 | +If you would prefer to use your browser's default PDF reader (either |
| 166 | +its built in one, or an external application that you have configured) |
| 167 | +then add a comment of the form: |
| 168 | + |
| 169 | +`% !TEX ` _any text_ `pdf` |
| 170 | + |
| 171 | +The default behavior can be explicitly specified by using `pdfjs` as |
| 172 | +the final token. For debugging you may sometimes want the log file |
| 173 | +returned, even if the document produces a PDF with |
| 174 | +no errors. This can be specified by using `log` as the final token in |
| 175 | +the comment. |
| 176 | + |
| 177 | +As an alternative to using a `% !TeX` comment, you may specify the |
| 178 | +site default return parameter on the [Site Settings](settings) |
| 179 | +page. The Settings are specific to each browser, so for example you |
| 180 | +may choose to use the default `pdfjs` setting on your mobile device, |
| 181 | +but use `pdf` on your desktop browser to use its default PDF rendering. |
| 182 | + |
| 183 | + |
| 184 | +--- |
| 185 | + |
| 186 | +## HTML output (make4ht, LaTeXML, lwarp) |
| 187 | + |
| 188 | +If using the TeXLive.net system, then additional return options, |
| 189 | +`make4ht`, `LaTeXML` or `lwarp` may be specified. These return one or more HTML pages |
| 190 | +in the frame within the page. It may be specified at the same time |
| 191 | +as `xelatex` or `lualatex` as well as the default `pdflatex` processing. |
| 192 | + |
| 193 | +To enable this output, add a comment of the form: |
| 194 | + |
| 195 | + |
| 196 | +``` |
| 197 | +% !TeX make4ht |
| 198 | +``` |
| 199 | +{: .noedit :} |
| 200 | + |
| 201 | + |
| 202 | +Replacing `make4ht` by `LaTeXML` or `lwarp` to specify those systems. |
| 203 | + |
| 204 | + |
| 205 | + |
| 206 | +Alternatively you may specify `make4ht`, `LaTeXML` or `lwarp` as the default return option |
| 207 | +on the [Site Settings](settings) page. |
| 208 | + |
| 209 | + |
| 210 | +If using a locally installed TeX system, the same output as the `make4ht` option may be obtained |
| 211 | +by executing |
| 212 | + |
| 213 | +``` |
| 214 | +make4ht document.tex "learnlatex4ht,2,mathml,mathjax,svg" |
| 215 | +``` |
| 216 | +{: .noedit :} |
| 217 | + |
| 218 | +with the addional option `-x` or `-l` if XeLaTeX or LuaLaTeX are specified. |
| 219 | + |
| 220 | +When running locally, other configurations would be possible. See the [make4ht |
| 221 | +manual](https://texdoc.org/pkg/make4ht). |
| 222 | + |
| 223 | + |
| 224 | +For `LaTeXML` to run locally, you would need to install LaTeXML (it is not part of TeX Live or MiKTeX) |
| 225 | +and use |
| 226 | + |
| 227 | +``` |
| 228 | +latexml document.tex > document.xml |
| 229 | +latexmlpost --format=html5 \ |
| 230 | + --javascript='https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js' \ |
| 231 | + --destination=document.html" document.tex |
| 232 | +``` |
| 233 | +{: .noedit :} |
| 234 | + |
| 235 | +Many other LaTeXML configurations are possible, |
| 236 | +[as described in the manual](https://dlmf.nist.gov/LaTeXML/manual/). |
| 237 | + |
| 238 | + |
| 239 | +The `lwarp` configuration is not documented here, it is somewhat experimental and subject to change. |
| 240 | +The current version can be seen at the |
| 241 | +[source repository](https://github.com/davidcarlisle/latexcgi/blob/main/lwarp/latexcgilwarp). |
| 242 | + |
| 243 | + |
| 244 | +--- |
| 245 | + |
| 246 | +[^1]: Note that during development of the site we have also used |
| 247 | + [LaTeX.Online](https://latexonline.cc/) and |
| 248 | + [LaTeX-on-HTTP](https://github.com/YtoTech/latex-on-http) |
| 249 | + and we thank the developers of those services for making updates to enable |
| 250 | + the examples on this site to be available at an early stage. |
| 251 | + |
| 252 | + |
0 commit comments