0

I have a (auto-generated) list, that can span multiple pages (I think I will take a longtable-environment).

What I want to achive is, when TeX decides to insert a page break, I want to have a small box below some of the columns, that prints a known value, and print this box also on the next page.

And I want to print some values at bottom of the tabular

I have no idea how to address this problem.

col1 col2  
100  200   <- known 100 and 200
300  400   <- known 400 and 600 
---------  <- LaTeX decides to page break
500  600   <- known 900 and 1200

It should do

 col1 col2  
 100  200
 300  400
[400][600]  <- use known
-----------
[400][600]
 500  600
{900}{1200}
 {sum}

EDITH: I thought I coud use \endfirsthead and so, but, the values will not be changed dynamically. Maybe there is a trick

\documentclass[a4paper]{scrartcl}
\usepackage{longtable}
\begin{document}
\newcommand{\uebertraga}{0}
\newcommand{\uebertragb}{0}
\newcommand{\summe}{0}
\begin{longtable}{cc}
col1 & col2\\\endfirsthead
col1 & col2\\
Übertrag: \uebertraga & \uebertragb\\\endhead    %<- dynamic binding?
Übertrag: \uebertraga & \uebertragb\\\endfoot
gesamt: \uebertraga & \uebertragb\\
Summe: \summe\\\endlastfoot

\renewcommand{\uebertraga}{100}
\renewcommand{\uebertragb}{200}
\renewcommand{\summe}{300}

100 & 200 \\\newpage

\renewcommand{\uebertraga}{400}
\renewcommand{\uebertragb}{600}
\renewcommand{\summe}{1000}

300 & 400 \\    

\end{longtable}
\end{document}

EDITH 2: Question

Is it possible to access f.e. the box-variable \LT@foot from the longtable-package outside the package?

6
  • Not quite clear to me. Would the values so printed change from one page to another page if there are more than two pages, or is it fixed?
    – Bernard
    Jun 13, 2018 at 8:04
  • it is a calculated sum of the already displayed values (with some extra tweaking for hidden prices and positions). So yes, they change Jun 13, 2018 at 9:41
  • it is possible but not easy as the header and footer in longtable are fix boxes. So one either need to patch the output routine of longtable, or hide such values in the last and first line of a longtable. See e.g. tex.stackexchange.com/questions/384886/… Jun 13, 2018 at 10:02
  • @UlrikeFischer could you help me with some links, how to "patch the output routine of longtable"? I am not able to change the content of \LT@foot even from inside the longtable-package by exporting a function, that sets the box \LT@foot to another content, the output uses the firstly instantiated value Jun 14, 2018 at 11:29

0

You must log in to answer this question.

Browse other questions tagged .