Graphics, Figures & TablesAutomatic Generation of a Table

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
Uchman
Posts: 6
Joined: Thu Feb 16, 2012 11:18 am

Automatic Generation of a Table

Post by Uchman »

Hi!

I am trying to typeset a small document to help me with the creation of archives. I want to create a number of title cards to put on the fronts of the folders, and then, using the same data, make a list of all the folders.

So far, I used the mailmerge package and two separate files --- one for the cards, the other for the list, but since there are sometimes a lot of corrections to be made to the titles, it becomes quite cumbersome. Moreover, some people from other departments, who are not LaTeX-literary, asked me to show them how to use it, so I want to keep it as simple as possible.

I have been trying with the formlett package, because it has an organised structure of the input, but I cannot seem to make it print the table. All I get is the first page of
Minimal.pdf
(41.8 KiB) Downloaded 161 times
, when it should look like
Spis teczek 2002 .pdf
(40.39 KiB) Downloaded 181 times
.

Here is the actual code (sorry for the bulkiness):

Code: Select all

\documentclass[a4paper,12pt,draft]{article}
\usepackage[polish]{babel}
\usepackage[OT1,OT4]{fontenc}
\usepackage{xltxtra}
\usepackage{paralist}
\usepackage{tabularx}
%\usepackage{supertabular}
\usepackage{formlett}
\usepackage{longtable}
\usepackage[left=1.5cm,right=1.5cm,top=2cm,bottom=2cm]{geometry}
\setmainfont[Mapping=tex-text]{%
%Times New Roman}
%Gill Sans MT}
Arial}
\sloppy
\pagestyle{plain}

\makeatletter
\renewcommand{\@evenfoot}{\hfill\thepage/\pageref{LastPage}\hfill}
\renewcommand{\@oddfoot}{\@evenfoot}
\makeatother

\newcounter{Numer}
\newcounter{Teczki}

\def\urzad{Urząd Gminy i~Miasta Dobczyce}
\def\referat{Referat Inwestycji, Rolnictwa i~Gospodarki Komunalnej}
\def\tworca{Joanna Mus}

\begin{document}
\beginletter%---------------------------------- This part is responsible for title cards, and it works
\NOPAGENUMBERS\parindent=0pt
{\centering\bf\urzad\\\vspace{3mm}
\centering\referat\\\normalfont}
\vspace{2cm}
{\bf Znak:} \paras[1]\hfill {\bf Kat. akt:} \paras[2]

\vspace{2cm}
%\setlength{\floatsep}{0pt}
{\centering\large\bf \paras[3]\\}

\vspace{15mm}\begin{compactitem}\small
\paras[4]
\end{compactitem}\normalsize

\vfill
\checkparas[2][2]{LET}
\iftrue \ifemptyparas \else
	\ifnum \cachedata=1 \else {\centering Tom \paras[1][2]/\paras[2][2]\\} \fi \fi

\vfill
\checkparas[2][3]{LET}
{\centering\large\bf Roczne daty krańcowe akt: od \paras[1][3] do \iftrue \ifemptyparas \paras[1][3] \else \paras[2][3] \fi\\}
\vfill

{\large\bf Sygnatura akt:} %\rule{5cm}{0.1pt}
\vspace{3cm}\null
\newpage
\endletter%---------------------------------- End of title cards

\parindent=0pt\footnotesize
\textbf{\urzad\\
\referat}

\vspace{5mm}
\textbf{\centering Spis zdawczo-odbiorczy akt nr\rule{2cm}{0.1pt}\\}

\vspace{5mm}\scriptsize
\newcolumntype{C}{>{\centering}p{1cm}}%
\begin{longtable}{|r|c|m{5cm}|C|C|C|m{1.5cm}|m{1.5cm}|}\hline
\centering\textbf{LP}	&\textbf{Znak teczki}	&\centering\textbf{Tytuł teczki/tomu}	&\textbf{Daty skrajne}	&\textbf{Kate\-goria akt}	&\textbf{Liczba teczek}	&\centering\textbf{Miejsce przechowywania akt w~składnicy}	&\centering\textbf{Data zniszczenia lub przekazania do~arch. państwowego}\\\tabularnewline\hline%\endhead
\beginletter%---------------------------------- The problem lies somewhere from here...
\stepcounter{Numer}\arabic{Numer}	&\paras[1]	&\textbf{\paras[3]}\par\begin{compactitem}\paras[4]\end{compactitem}	&\paras[1][3] \checkparas[2][3]{LET}\iftrue \ifemptyparas \paras[1][3] \else \paras[2][3] \fi	&\paras[2]	&\checkparas[2][2]{LET}\iftrue \ifemptyparas 1\stepcounter{Teczki} \else \cachedata\addtocounter{Teczki}{\cachedata} \fi	&&\tabularnewline\hline
\endletter%---------------------------------- ... to here.
\end{longtable}

\vspace{1cm}\noindent\footnotesize
Spis zakończono na pozycji \arabic{Numer}.\\
Ilość teczek w~spisie: \arabic{Teczki}.\\
Sporządził: \tworca.\\
Dobczyce, \today

\vspace{1cm}\noindent\normalsize
\null\hfill Przekazujący:\label{LastPage}\hspace{8cm} Przyjmujący:\hfill\null
\newpage

\beginpilemode
%Znak;Kategoria;Tytuł;
%	Treść
%+Tom;Ilość tomów+Data początkowa;Data końcowa!
IRGK.V.6140/--/2002;B5;Lasy komunalne;
	\item Korespondencja w~sprawie wycięcia drzew
	\item Wnioski o~wydanie świadectwa świadectwa legalności pozyskania drewna i~wydane świadectwa
+1;2+2002;!
IRGK.IV.6210/--/2002;B5;Pozwolenia wodno-prawne;
	\item Decyzje w~sprawie wydania pozwolenia na pobór wody ze studni wierconych
	\item Zawiadomienie o~wszczęciu postępowania administracyjnego o~wydanie pozwolenia na pobór wody podziemnej i~jej zrzut
+1;+2002;!
\endpilemode
\end{document}
I will be grateful for any suggestions...
Attachments
Minimal.tex
MWE
(3.46 KiB) Downloaded 146 times
Uchman

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Stefan Kottwitz
Site Admin
Posts: 10324
Joined: Mon Mar 10, 2008 9:44 pm

Automatic Generation of a Table

Post by Stefan Kottwitz »

Hi Witold,

I guess the letter environment is a problem here, and putting ampersand symbols for separating the table columns into an environment. Removing \beginletter and \endletter would make the table row visible, if you also add an \item for the compactitem environment.

Stefan
LaTeX.org admin
Uchman
Posts: 6
Joined: Thu Feb 16, 2012 11:18 am

Automatic Generation of a Table

Post by Uchman »

Hi, Stefan,

Yes, there is something in formlett.sty that says

Code: Select all

\def\readarray#1#2{\read@array[&]{#1}{#2}}
--- maybe that is the problem?

But, you know, funnily enough, if you try

Code: Select all

\beginletter%---------------------------------- The problem lies somewhere from here...
\newcolumntype{C}{>{\centering}p{1cm}}%
\begin{longtable}{|r|c|m{5cm}|C|C|C|m{1.5cm}|m{1.5cm}|}\hline
\centering\textbf{LP}   &\textbf{Znak teczki}   &\centering\textbf{Tytuł teczki/tomu}  &\textbf{Daty skrajne}  &\textbf{Kate\-goria akt}       &\textbf{Liczba teczek} &\centering\textbf{Miejsce przechowywania akt w~składnicy}     &\centering\textbf{Data zniszczenia lub przekazania do~arch. państwowego}\\\tabularnewline\hline%\endhead
\stepcounter{Numer}\arabic{Numer}       &\paras[1]      &\textbf{\paras[3]}\par\begin{compactitem}\paras[4]\end{compactitem}    &\paras[1][3] \checkparas[2][3]{LET}\iftrue \ifemptyparas \paras[1][3] \else \paras[2][3] \fi   &\paras[2]      &\checkparas[2][2]{LET}\iftrue \ifemptyparas 1\stepcounter{Teczki} \else \cachedata\addtocounter{Teczki}{\cachedata} \fi        &&\tabularnewline\hline
\end{longtable}\endletter%---------------------------------- ... to here.
, that is wrap the table inside the letter environment, it works (well, sort of):
1.pdf
(41.04 KiB) Downloaded 229 times
. Maybe if I tried to put the table row by row...
Uchman
User avatar
Stefan Kottwitz
Site Admin
Posts: 10324
Joined: Mon Mar 10, 2008 9:44 pm

Automatic Generation of a Table

Post by Stefan Kottwitz »

Yes, if you use the table within the letter environment, it can directly see the ampersands. However, within the letter environment there's no need for a longtable I guess, a normal tabular environment would work.

Stefan
LaTeX.org admin
Uchman
Posts: 6
Joined: Thu Feb 16, 2012 11:18 am

Automatic Generation of a Table

Post by Uchman »

Yes, if you use the table within the letter environment, it can directly see the ampersands.
The problem is, however, that it produces a new table for each instance in the database, and that is not acceptable by the archiving standards. It has to be a single table, just like I included previously (Spis teczek.pdf).
I guess, a normal tabular environment would work.
Well, for a single year, we can reach anything up to 20--25 folders, I had better be on the safe side...

Anyway, I am still trying, and if something works, I will post the solution.
Uchman
Post Reply