tags:

views:

701

answers:

3

I'm just learning latex, so this may be trivial to some of you. I went through a few tutorials but they all seem to cover the same things.

I'm writing a big report - calculation all the way (and it has to be neat, because it's part of the documentation). It consists of a frame around the page (15mm margins), and 3 columns inside it: in the left column (3cm wide) are references from where the equation came from (e.g. "ABS 3-2-7"), in the middle is the calculation and in the right is the accepted value (5cm wide). It is a standard way of doing things, so I don't have a choice over the layout.

Now, I don't understand, how would I go in creating such layout ? The frame with columns has to appear on every page. How to accomplish that ? I've never seen such a document so I'm not sure how to ease the creation.

And second, how do I rename things that are in english language in document classes ? For example, "article" class, I have "References" and I need to have "Literatura". Is there a way to rename it without touching .cls file?

+1  A: 

In this case you probably want to use the tabular environment to generate the three columns (or as simon notes longtable if your report-thingy runs longer than one page). Something like:

\framebox{
  \centering
  \begin{tabular}{p{3cm}|p{\specialwidth}|p{5cm}}
  Ref 1-0-0 & 1.2345 & 1.2346 \\
  Ref 1-0-1 & 2.3456 & 2.3454 \\
  ...
  \end{tabular}
}

You'll note that I've used paragraph formatted columns (the p{<length>} formatting specifiers), and stuck a frame around it with \framebox.

You can either compute \specialwidth by hand, or calculate it:

\newlength{\specialwidth}
\setlength{\specialwidth}{\textwidth}
\addtolength{\specialwidth}{-10cm} % extra room for the seperators...

I can't help you on the internationalization issue...

dmckee
+2  A: 

For your first problem, look at the longtable package (available at ctan.org if you haven't already got it installed)

The problem with using tabular is it won't work as you want across pages.

As far as the second problem, it will depend on the environment and the document type, but typically you'll have to renew a command.

For example, add to the preamble \renewcommand\refname{Literatura} for the article class to do what you were asking for. If I recall correctly it is bibname for books.

simon
Yeah, longtable to cross page boundaries...
dmckee
No, I don't think that will help. I don't need to "continue the table" from one page to another. I just need a way to show the same lines (which separate the columns) on each page. 5 lines in total (2 horizontal, 3 vertical).
ldigas
How do you define something which should show on every page ? So it doesn't affect the rest of the document (so you can change it without affecting the rest) ?
ldigas
ldigas: I think it will work if you just continue the table as I suggested. It will allow you to repeat the header or not, but this will allow you too keep identical lines on every page. Supertable might work too, iirc. There are other ways, but this is dead easy.
simon
+1  A: 

Table design in LaTeX has not been made very easy. I would use tabbing rather than tabular and draw the lines manually to keep things simple. A downside is that you don't get any automatic sizing of the table cells, but since your format is fixed, I would consider it a good thing (i.e., if text overflows, you notice it and get to fix it yourself, and your table doesn't accidentally get stretched into the margins). If you use multiple tables like this in your document, try packaging the commands with \newenvironment.

\documentclass{article}
\usepackage[margin=15mm]{geometry}
\usepackage{amsmath}
\usepackage{calc}

\newlength{\tableheight}
\setlength{\tableheight}{20cm}  % how high to draw the lines of the table
\newlength{\rulethickness}
\setlength{\rulethickness}{1pt} % how thick lines to draw
\newcommand{\verticalline}{\smash{\rule[-\tableheight]{\rulethickness}{\tableheight}}}
\newlength{\myindent}
\setlength{\myindent}{3mm}      % how much to indent each column
\newlength{\leftcolumn}
\setlength{\leftcolumn}{3cm-\myindent}
\newlength{\midcolumn}
\setlength{\midcolumn}{\textwidth-3cm-5cm-\myindent-\rulethickness}
\newlength{\rightcolumn}
\setlength{\rightcolumn}{5cm-\myindent}

\begin{document}
\begin{tabbing}
  % first set the tab stops
  \hspace*{\myindent}\=\hspace{\leftcolumn}\=%
  \hspace{\myindent}\=\hspace{\midcolumn}\=%
  \hspace{\myindent}\=\hspace{\rightcolumn}\=\kill
  % then draw the lines
  \rule{\textwidth}{\rulethickness}\\[-\baselineskip]
  \smash{\rule[-\tableheight]{\textwidth}{\rulethickness}}\\[-\baselineskip]
  \verticalline\>\>\verticalline\>\>\verticalline\>\>\verticalline\\
  % Now start the table: indent the first column with \>
  \>ABS 3--2--7 
  % ... and each additional column with \>\>
  \>\> $\iint_{-\infty,-\infty}^{\infty,\infty} e^{-x^2-y^2}\, dx\,dy$ 
  \>\> 2.507 
  % End each line with \\, add e.g. [2pt] to get 2pt extra space if required
  \\[2pt]
  % here's another line:
  \>ABS 3--2--8 \>\> $\displaystyle\sum_{k=0}^n k^2$ \>\> $\frac12 n(n+1)$ \\
  % etc. Be careful not to overflow the table - there's no automatic check for that.
\end{tabbing}

\newpage % also remember to start a new page after the table

\end{document}

To change the fixed names, see this FAQ, or possibly this one if you are using babel.

Jouni K. Seppänen