Archive for the ‘latex’ Category

 

How to convert LATEX to OPENOFFICE – 2. January, 2010

For a long time I know that I can export lyx files to ODT format, and it does a pretty good job. Today, I start lyx with moving it to the background and I looked what’s going in on when I export to ODT. It’s using a commant htlatex, which can be found in the Debian package tex4ht .

Here’s how to use it:

htlatex yourlatexfilename.tex "xhtml,ooffice" "ooffice/! -cmozhtf" "-cooxtpipes -coo"

This is pretty CPU intesive if your document is pretty complex, so be patient !

A Brief what to expect and few cavities I could not solve:

  1. Images are not inserted! So total fail here.
  2. Bibliography is done pretty good, design of your style is kept, and all the references are inserted in the correct place. However, the bibliography items, are just text, not like real references! So, here I give it “almost good”
  3. Styles are done nicely, so it’s very good.
  4. Dynamic lists, i.e. Table of Contents, List of Figures etc, are not created ! Clicking Update on the Table of Contents solves the problem, however, I tried doing this on the List Of Figures, and created again the Table on Contents ! So here htlatex gets a “sufficient” grade, but not good!

So, in my opinion this is not a very good to my need, but never the less, I can’t find any better alternative. If you find a better one or know how to solve one of the above issues, I’ll be happy to know.


				
Posted in latex

More on Custom Lists in Latex – 23. November, 2008

Latex provides great tools for designing your documents. If you are writing a book, an article or a manual with code snippets, figures, and tables and you’d like to count and number them you can do it fairly easily.

First you can use built in listing tools like \equation \figure \table and so on. But let’s say you want to distinguish between Figures which are illustrations and Pictures which are real world picture, or lets say you want to number out code snippet in your document, or number out examples of solutions to exercises.

For this purpose comes the real power of  Latex, custom commands. Here I’ll briefly show you how to create a custom command to count examples in your text book.

In the permeable of the document we’ll add a new counter, and add +1 to it, since Latex  by default, starts counting from 0.
\newcounter{example}
\addtocounter{example}{1}

Now we have a new counter which can be accessed in the document with the call \arabic{example} or with the call \theexample. But that’s really something easy. Let’s say I want the numbering scheme to be: X.Y like before, X is the chapter and Y the example. For this will have to create a new command in the permeable of the document. Here is how it is easily done:
\newcommand{<\thenameofyournewcommand>}[<Number of variables the command takes>]{<a set of latex command to be executed in your new command>}
So we see a custom command is a little Macro or Latex script if you want to think about it like that.

(more…)

Posted in latex

Custom Lists in Latex – 16. November, 2008

I found my self looking for a solution how to make a custom list in latex. I found many solutions, but I didn’t really find what I wanted: custom lists which are chapter aware. Let me explain better what I mean. Let’s say you write a book and at the end of each chapter you want to give questions, which are numbered x.y, where x is the number of chapter, and y is the number of question.
Here is how to do it:

\documentclass[12]{book}
\newcounter{question}

\begin{document}
\chapter{beginning}
\section{hello}
hello world
\begin{list}{Question \arabic{chapter}.\arabic{question}}{\usecounter{question}}

\item  one
\item  two
\item  three
\end{list}

\chapter{More into your book}
\section{hello}
hello world
\begin{list}{Exercise \arabic{chapter}.\arabic{question}}{\usecounter{question}}

\item  one
\item  two
\item  three
\end{list}

This will result in out put of two chapters, having in the end of each chapter list of questions numbered 1.1, 1.2, 1.3 and 2.1, 2.2, 2.3.

Further customization can be done with more complex numbering such as:

\begin{list}{Exercise \arabic{chapter}.\arabic{section}
.\arabic{question}}{\usecounter{question}}

which will yield numbering like 1.1.2 and so on.

That’s it. A quick one this time…

P.S more on lists can be found here.

Posted in Linux, latex