<< Chapter < Page Chapter >> Page >

Rules for converting latex source

Connexions generally does a fine job translating LaTeX source code into the native Connexions mark-up language.However, one may need to adapt one's usual typesetting habits to work around a few idiosyncrasies.Firstly, one should not invest effort in adjusting page margins, line spacing, and fonts: the converter will strip away much ofthis veneer and replace it with the standard Connexions stylings. Equations will not be converted into graphics (as is commonin LaTeX to HTML conversion), but will rather be translated into MathML fonts that can be subsequently edited in Connexions.Do not include a title or abstract in your LaTeX document: these must be entered into Connexions manually when you set up your module.

The Connexions converter will not properly handle several LaTeX commands, as noted in the online help(http://cnx.org/help/UsingLaTeX ).

  • The \mbox command is not supported.
  • Nested tables are not supported.
  • LaTeX allows functions like \sqrt to be followed by asingle argument without brackets, e.g., \sqrt\pi .The Connexions translator misses this syntax; one instead needs to use brackets \sqrt{\pi}.

Future editing

You will likely want to make changes to your file at some point after you have uploaded the LaTeX document into Connexions.Should you edit the LaTeX document, then re-import, or should you alter the code directly in Connexions?If you have major mathematical edits, it may well be easiest to directly alter the LaTeX source. Beware that when you upload, any changes thatyou made to the previous version directly in Connexions will be overwritten. This is not such a concern if you can make all the edits you desiredirectly in LaTeX; however, this is not always the case: some things must be done in Connexions. (For example, see the comments aboutthe verbatim environment in "Incorporating code" below.)

Importing equations

We list a few sample equations to test the ability of the converter. For example, we have the Pythagorean Theorem, a 2 + b 2 = c 2 . This is an example of an inline equation, as is the integral 0 e - x 2 d x . The same integral can also be typeset as a displayed equation,

0 e - x 2 d x .

To typeset a matrix, use the LaTeX array environment:

A = a b c d .

(Note that the TeX \matrix command does not properly translate.)

A sample figure

shows the gap between consecutive prime numbers; see  . Beware: though the original image was drawn in precise vector graphics, theconverter has turned it into a bitmap of substantially diminished quality. Make sure you make your fonts large enough that they remain legible afterthe translation (unlike this figure). The translator also seems to place the figure directly after the reference,so the location of the figure in your Connexions document will generally differ from its placement in your LaTeX document (often for the better).Notice that if you choose the print the Connexions module as a .pdf file, the output will include the bitmapped image, rather than the sharpversion in your original document.

The gap between consecutive prime numbers.

A sample table

provides a list of the first seven Mersenne primes.(Beware: The Converter does not properly handle the caption command for tables. For example,if a caption precedes the table itself, as is the usual custom, the reference does not translate properly.Moreover, Connexions seems to draw boxes around all cells, regardless of the formatting in the LaTeX source.)

Mersenne primes.
k 1 2 3 4 5 6 7
k th Mersenne prime 3 7 31 127 8191 131071 524287

Incorporating code

You might naturally want to include small snippets of code with your report, which you would incorporate in LaTeX using the verbatimenvironment. For example, the following MATLAB commands produce the Mersenne prime datagiven in .

  p=[1:20]';

  pmer = p(isprime(2.^p-1));

  disp([[1:length(pmer)]' 2.^pmer-1])

At present, the Connexions LaTeX translator does not properly handle the verbatimenvironment, though this is expected to improve in an updated translator that will be available in a few months.In the meantime, it is best to leave code out of your LaTeX document, and paste it into Connexions manually as a<code>block.

Adding a bibliography

Connexions works well with LaTeX's bibliography tool, BibTeX. This tool allows you to create a .bibfile that contains a database of papers and books that you regularly reference.For example, this template is accompanied by a file called mybibfile.bibthat contains the three references cited here.You add citations in your LaTeX document using the \citecommand. See Lamport  for details.

Acknowledgements

This Connexions module describes work conducted as part of Rice University's VIGRE program, supported by National Science Foundationgrant DMS–0739420.

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, The art of the pfug. OpenStax CNX. Jun 05, 2013 Download for free at http://cnx.org/content/col10523/1.34
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'The art of the pfug' conversation and receive update notifications?

Ask