Sunday, May 6, 2012

How to use XeLaTeX in Kile + change the font to Arial

14 Jamadilakhir 1433H, Ah.

Update: 8th May 2012, Se.

Assalamualaikum. By preparing a research proposal, my husband is learning how to use LaTeX in Kile. He is starting from scratch and wants to use the Arial font instead of the default font, Computer Modern.

i myself don't know how and never thought of such a thing. After a late evening of much ask and answer, try and error, tease and jabber, google and sigh, eat and idle, and much more... Here's how to implement the Arial font in a LaTeX output document (referring to the PDF file).

You'll notice the difference with the Panel in a few screenshots because i was working on my husband's laptop ;). The fine editing was done on my laptop later on.



Part A: Obtaining the Arial font

1. Run Ubuntu Software Center.


2. In the search field, type-in the search term "arial". The results will auto-filter. See Pic 1.


3. Select the result: Installer for Microsoft TrueType core fonts (ttf-mscorefonts-installer). See Pic 1.

If you want to install straightaway-no-delays, click the Install button.
* In Pic 1, seeing that i have already installed these fonts, the Install button has turned into the Remove button.

If you want to see the available Add-ons, click the More Info button. See the Add-ons, shown in Pic 2. When you are ready to install, click the Install button.

Pic 1 - Refer Step 2 and Step 3. Searching for the Arial font installer in Ubuntu Software Center.


Pic 2 - Refer Step 3. The Add-ons for the Installer for Microsoft TrueType core fonts (ttf-mscorefonts-installer).


4. An Authenticate window will appear prompting for your password. Key-in your password in the Password: field, then click the Authenticate button. See Pic 3.

Pic 3 - Refer Step 4. Password prompt to authenticate the action.


5. After downloading but before installing the fonts, a EULA(?) window will appear. To accept the terms and conditions, put a tick in the box. Then click the Forward(?)/Next(?)/OK(?)* button.

* Hoping to make a screenshot of the EULA(?) window, i removed the fonts (using the Remove button in Pic 2) then re-installed (using the Install button) but the EULA window did not appear on the second install :-\. Sorry.


6. Once the fonts are installed, the Install button will turn into the Remove button. See Pic 1 and Pic 2.



Part B: Installing the xltxtra package

Without the xltxtra package, you will get one of the errors mentioned in Step 16.

If you already have this package, then skip to Step 12.

If you do not have this package yet, then proceed to Step 7.


7. Run Ubuntu Software Center.


8. In the search field, type-in the search term "xltxtra". The results will auto-filter. See Pic 4.


9. Select the result: TeX Live: XeTeX packages (texlive-xetex). See Pic 4.

If you want to install straightaway-no-delays, click the Install button.

If you want to see the list of XeTeX packages and available Add-ons, click the More Info button. When you are ready to install, click the Install button.

Pic 4 - Refer Step 9. Searching for the xltxtra package installer in Ubuntu Software Center.


10. An Authenticate window will appear prompting for your password. Key-in your password in the Password: field, then click the Authenticate button. See Pic 3.


11. Once this package is installed, the Install button will turn into the Remove button. See Pic 5.

Pic 5 - Refer Step 11. The Install button is now the Remove button.



Part C: Producing document with Arial font

12. Run Kile.
i'm not sure if it works the same in other editors, though giving it a try shouldn't hurt :).


13. Create a new document. Click File > New. See Pic 6.

Pic 6 - Refer Step 13. Creating a new document in Kile.


14. A window* will appear. See Pic 7.

* The pop-up windows on my husband's laptop doesn't seem to have a title bar. Checking on my laptop, the window is New File -- Kile.

Under the Document Type section, select LaTeX Document.

Under the Template section, scroll to the end then select Xelatex.

Then click the OK button.

An Untitled document with contents is automatically created. See Pic 8.

Pic 7 - Refer Step 14. The New File -- Kile pop-up window. Creating a new LaTeX document using the XeLaTeX template.


Pic 8 - Refer Step 14. Screenshot of the newly created XeLaTeX template titled Untitled in Kile.


15. Save your document. If you don't save now, you will still need to do so and will be prompted with:
[QuickBuild] Please save the untitled document first.
when building/compiling later on. See Pic 9.

Pic 9 - Refer Step 15. Save first, only then can build.


Click File > Save As... .

In the pop-up window*, see Pic 10:

* Again, no title bar. Checking elsewhere, it's the Save File -- Kile window.

Under the Places section, locate where on your hard-disk do you want to save this document.

In the Name: field, give it a name.

Then click the Save button.

i named mine xeletex test  (i know, i misspelled it out of excitement :P) and placed it on the Desktop.

Pic 10 - Refer Step 15. Give the document a name and place.


16. If you were to click Build > QuickBuild now, among the many possible errors you might encounter are:

./test:5:File `xltxtra.sty' not found. ^^M
[PDFLaTeX] 1 error, 0 warnings, 0 badboxes
See Pic 11. This error is because the package is not installed in the system.

In order to eliminate this error, proceed to Part B. After Part B is completed, proceed to Step 17.

Pic 11 - Refer Step 16. Error because the xltxtra package is not installed.


*** this package currently works only with XeTeX ***
See Pic 12. i'm guessing you will get this error because of the QuickBuild. In order to eliminate this error, proceed to the next step.

Pic 12 - Refer Step 16. Error probably because of the QuickBuild.


17. In the document, change the font from Linux Libertine O to Arial.

Then click Build > Compile > XeLaTeX, see Pic 13. Alternatively, the XeLaTeX shortcut button is shown in Pic 14.

This time there supposedly should be no more errors, see Pic 15:
[XeLaTeX] 0 errors, 0 warnings, 0 badboxes
[XeLaTeX] Done!

Pic 13 - Refer Step 17. Compiling using XeLaTeX.


Pic 14 - Refer Step 17. The XeLaTeX shortcut.


Pic 15 - Refer Step 17. Done! To copy+paste the content you see here, go to Part D.


18. To see the output:

Either view the PDF file straightaway. Locate the file at the same place where you saved the XeLaTeX document when in Step 15.

Or

Click Build > View > ViewPDF, see Pic 16. Alternatively, the ViewPDF shortcut button is shown in Pic 17.

Pic 16 - Refer Step 18. Viewing the output file using ViewPDF.


Pic 17 - Refer Step 18. The ViewPDF shortcut.



Part D: It's Arial, alright!

Some might argue that the font in use is not Arial but a clone or a close mimic of it. This article shows the differences between the Helvetica, Arial, and Grotesque fonts: How to Spot Arial.

Now that you know how the "a" of the Arial font is supposed to look like, Pic 18 is my proof that the font used in Part C is really Arial.

Pic 18 - The document in Okular at 250% zoom.


Here's the content of the file seen in Pic 15:

\documentclass[a4paper,10pt]{article}
%\documentclass[a4paper,10pt]{scrartcl}

\usepackage{xltxtra}

\setromanfont[Mapping=tex-text]{Arial}
% \setsansfont[Mapping=tex-text]{DejaVu Sans}
% \setmonofont[Mapping=tex-text]{DejaVu Sans Mono}

\title{Arial font}
\author{}
\date{}

\begin{document}

\maketitle

\Huge{Aa Bb Cc Dd Ee Ff \\
Gg Hh Ii Jj Kk Ll \\
Mm Nn Oo Pp Qq Rr \\
Ss Tt Uu Vv Ww Xx \\
Yy Zz 0 1 2 3 \\
4 5 6 7 8 9}

\end{document}

Still not convinced?

Open the generated PDF file.

Click File > Properties, see Pic 19.

In the Properties pop-up window, under the Fonts tab is the list of embedded fonts, see Pic 20. The Arial font is embedded under its "postscript name" as ArialMT. Read here about Arial and Arial MT: Arial being changed to ArialMT in PDF.

Convinced? :)

Pic 19 - Summoning the properties.


Pic 20 - Arial font embedded in PDF document.



Here, i would like to thank the person who taught me the basics of LaTeX, Dr. Bakri Adam from Faculty of Science, Universiti Putra Malaysia (UPM).

Tuesday, May 1, 2012

List of programs to install/uninstall after a clean wipe

8 Jamadilakhir 1433H, Isnin.

Update: 13th Nov 2012M, Se. 20th June 2012M, Ra. 9th May 2012, Ra. 5th May 2012, Sab.

Assalamualaikum. Often i find myself writing on paper the list of programs i need to reinstall after a clean wipe (see post here, My experience upgrading to 12.04 then downgrading to 11.10), some other time just memorizing or writing on a whiteboard. After that install the list is usually lost or obsolete.

The easy way is to make an accessible and rewritable list. This is my list of programs to be installed/uninstalled in case of another upgrade/downgrade/format. Some programs are necessary, some are optional.


To install...
  • Audio Tag Tool

  • GIMP Image Editor

  • Chromium Web Browser

  • Inkscape Vector Graphics Editor

  • Kile, and Okular
TeX Live: LaTeX supplementary packages (texlive-latex-extra) via Ubuntu Software Center

  • KRuler


  • Screen Ruler

  • Synaptic Package Manager
cups-pdf

  • VLC media player

  • XSane Image scanning program


To uninstall...
  • Gwibber Social Client

  • AisleRiot Solitaire