Pedro's blog: db2, mysql, php, linux and performance

Latex longtable issue
10/01/2010, 11:37
Filed under: Latex | Tags: ,

I had a problem with a longtable in LaTeX, the margins where so much big and my table was disappearing on the right side:

Longtable issue

The code was:

\begin{longtable}{| c | c | c |}
\rowcolor[rgb]{0.52, 0.52, 0.52} \textbf{Castellano}  & \textbf{Inglés}  & \textbf{Valenciano}  \\ \hline
Artes decorativas /aplicadas    &    Applied Arts    &    Arts decoratives     \\ \hline


For fixing it, I had to write the width of every column, and LaTeX did the rest:

\begin{longtable}{| p{0.30\linewidth} | p{0.30\linewidth}  | p{0.29\linewidth}  |}
\rowcolor[rgb]{0.52, 0.52, 0.52} \textbf{Castellano}  & \textbf{Inglés}  & \textbf{Valenciano}  \\ \hline  \endfirsthead
Artes decorativas /aplicadas    &    Applied Arts    &    Arts decoratives     \\ \hline

The result:
Longtable issue
And now everything is working properly, I lost the center property but I don’t care.

If you want, you can use the \endhead, \endfoot and \endlastfoot for adding a line on the table with some text before break the line and at the begging of the new page on the continuation of the table, looks cool:

\begin{longtable}{| p{0.30\linewidth} | p{0.30\linewidth} | p{0.29\linewidth} |}
\rowcolor[rgb]{0.52, 0.52, 0.52} \textbf{Castellano} & \textbf{Inglés} & \textbf{Valenciano} \\ \hline \endfirsthead
\caption[Técnicas]{Técnicas} \label{lsttecnicas} \\ \hline
\rowcolor[rgb]{0.52, 0.52, 0.52} \textbf{Castellano} & \textbf{Inglés} & \textbf{Valenciano} \\ \hline \endfirsthead
\hline Continuación de la tabla \\ \hline \hline \endhead
\hline\hline {\scriptsize Continúa en la página siguiente} \\
\hline \endfoot

    Primera línea \\ \hline
    Segunda línea \\ \hline


Listings code on Latex – XSLT
09/12/2009, 17:47
Filed under: Latex | Tags: , , ,

Using the package listings you can add non-formatted text as you would do with \begin{verbatim} but its main aim is to include the source code of any programming language within your document.  Wikibooks

One of the problems of this package is the poor colored syntax with some programming languages, like XML or XSLT, trying language=XML and language=XSLT, the result was… bullshit poor, I prefere to use language=HTML because it has a minimal pretty syntax  and I made some changes, the result:

emph={schema, element, complexType, choice, simpleType, sequence, restriction, pattern}, emphstyle=\color{red},
morekeywords={xml, ref, xs, version, targetNamespace, minOccurs, maxOccurs}

<?xml version=”1.0″?>
<xs:schema targetNamespace=…


It looks like:

Listings and XML

Another problem solved! 😆