Showing posts with label latex. Show all posts
Showing posts with label latex. Show all posts

Sunday, November 11, 2012

Using IEEEtran latex style for language other than English

I had to write a paper in Croatian and I decided to use IEEEtran latex style. The problem was that it uses, and outputs, English words as a default language. That means, for example, that it is outputting words Abstract, Keywords, etc. which don't fit my local language. I managed to solve that problem fairly easy, but I wasn't able to Google anything about this. So, I decided to write how I did it in case someone else needs this too. There are two things you have to translate. The first one is IEEEtran itself, while the other is bibliographic style.

To translate words that appear in your text after the article is generated you have to insert the following lines somewhere at the beginning of the document, but certainly after you've included IEEEtran style:
\def\abstractname{Sažetak}
\def\IEEEkeywordsname{Ključne riječi}
Note that in this case I'm redefining what latex will output as abstract title and keywords title. Basically, whatever appears in your document in English you can translate by first searching for that words in IEEEtrans.cls and looking what associated keyword name is (e.g. abstractnameIEEEkeywordsname). Finally, you add \def commands similar to those I showed above. Note that you first have to find where IEEEtrans.cls is. On Fedora, if you used package tetex-IEEEtran, then it is in directory /usr/share/texmf/tex/latex/IEEEtran/.

Bibliography style, on the other hand, has to be localized separately and in a special way. First, you have to enter special reference in one of your bibliography databases, or, better yet, you can create a separate database just for that purpose. This bibliography entry has to have the following format:
@IEEEtranBSTCTL{BSTcontrol,
  CTLname_url_prefix = "[Online]. Raspoloživ:"
}
In this case I'm changing default output for URL from "[Online]. Available: " to something more Croatian like (though not entirely, there is no equivalent word for Online in Croatian). Then, somewhere within your document you are writing, you have to cite this reference with a special cite command:
\bstctlcite{IEEEexample:BSTcontrol}
Now, if you make dvi/ps/pdf version of your document you'll see that the text really changed (in case you use entry that has url field defined). You can find some details in IEEEtran's bibliography manual. To find out what exactly I have to change, I was searching through IEEEtrans.bst file which is in directory /usr/share/texmf/bibtex/bst/IEEEtran/ (again, if you use Fedora's package).

Wednesday, June 6, 2012

Fedora 17, XeLaTeX and Beamer...

I decided to write this post about XeLaTeX and my attempts to process one presentation written using Beamer class into PDF file. The reason is that I certainly lost few hours trying to resolve the set of errors, and maybe someone finds this information/experience helpful.

The first problem I had after starting xelatex was the following error:
! Package pgfsys Error: Driver file ``pgfsys-xetex.def'' not found..

See the pgfsys package documentation for explanation.
Type  H   for immediate help.
 ...                                             
                                                 
l.847 ...ver file ``\pgfsysdriver'' not found.}{}}
                                                 
? X
No pages of output.
So, I tried to find out which package provides this file using yum. But, no luck there. Then, I continued with google-fu. I found many links, but nothing that could be applied to my case, until I stumbled on this solution which basically tells me to copy one existing pgfsys file into the missing file, without any changes. What this post doesn't tell you explicitely is that you have to run texhash after that so that tex's file database is rebuilt.

When I again started xelatex, this time it seemed as if it will work! It was processing files and constantly giving some output. But no! At one point it stopped and I got the following error:
(/usr/share/texmf/tex/latex/beamer/themes/font/beamerfontthemeserif.sty)
! Font \zf@basefont="TeX Gyre Cursor" at 10.0pt not loadable: Metric (TFM) file
 or installed font not found.
\zf@fontspec ...ntname \zf@suffix " at \f@size pt
                                                  \unless \ifzf@icu \zf@set@...
l.80 ...d,NoCommon,NoContextual}]{TeX Gyre Cursor}
                                                 
?
Back to google-fu! Still, for this one it was easier to identify what's the problem. Namely, the font is missing (Metric (TFM) file or installed font not found). Again, using yum I found out that this font isn't packaged with Fedora 17 but it can be obtained from here. I downloaded zip archive, unpacked it, and moved all the font files into /usr/share/fonts/otf directory (before that I created otf subdirectory as it didn't exist). Afterwards, everything worked and presentation was successfully created. Note that I initially tried to place those fonts into /usr/share/texmf/fonts/opentype/public/tex-gyre/ directory. But that didn't work for unknown reason!

And guess what?! Now the source tex file was successfully transformed into PDF file.

While googling to find out solutions to problems I had, I realized that TeXLive distribution in Fedora 17 is 2007, while the newest version is 2011 with 2012 in development. Furthermore, I found out that  there is a plan for Fedora 18 to update TeXLive to at least version 2012. Since beta (or alpha) packages are readily available for F17, and I felt bold enough, I decided to give it a try.  So I installed repository per instructions on a given page and run 'yum update', and after a long wait, I tried again to run xelatex on the beamer presentation. This time I was completely out of luck:
kpathsea: Running mktexfmt xelatex.fmt
I can't find the format file `xelatex.fmt'!
For some reason, there was no xelatex.fmt file. As usual, first thing was to run 'yum whatprovides' to find out which package provides that file. But, none does! It seems to be a 'bug' in packages, so I had to revert texlive distribution. This was also a kind of a trial and error process, but to cut the story short what I did was: disabled texlive repository with experimental packages. Then, I used rpm to force removal of existing texlive packages, and then using yum I reinstalled the old ones (note that yum downgrade didn't work!). Finally, I used 'yum check/install' to fix any unresolved dependencies.

About Me

scientist, consultant, security specialist, networking guy, system administrator, philosopher ;)

Blog Archive