Latex Longtable Continued on Next Page

I changed your given code to solve the problem with the table head and foot of longtable in pgfplotstable. I kicked out the styling of the columns, to give it to you as homework (please read the documentation of pgfplotstable!).

To get rid of the first line (see result later) you can add an empty header. Please follow the advices in this question.

The complete MWE (including .dat file with package filecontents; see that I added some data after line 0.0 0.0 0.0 0.0; marked changings with % <======):

          \RequirePackage{filecontents} \begin{filecontents*}{\jobname.dat} theta1    r2v    r3v      x      y 73.32513 0.08109 0.32216 1.07136 1.58646 81.52127 0.39714 0.18930 1.12726 1.54498 11.42881 0.15561 0.40579 2.00083 -0.25418 82.20383 0.26427 0.26641 0.98759 1.65272 56.91233 0.08282 0.17536 1.39728 1.09515 8.77864 0.30099 0.46950 2.07209 -0.48038 25.06484 0.13149 0.43797 2.02329 0.26017 49.21934 0.32704 0.27508 1.78136 0.81424 86.17562 0.34461 0.31124 0.95389 1.75653 86.83997 0.37408 0.29352 0.96191 1.74816 14.18518 0.22527 0.10387 1.73510 -0.29920 87.35335 0.04191 0.15062 0.60779 1.62930 86.14503 0.11449 0.23546 0.72013 1.69588 43.68381 0.45667 0.11524 1.82554 0.43447 72.02524 0.07619 0.42215 1.13327 1.65837 12.76977 0.41291 0.09738 1.76232 -0.52640 37.95852 0.26917 0.11296 1.74265 0.39662 82.41620 0.49807 0.08535 1.18931 1.44604 71.29866 0.03909 0.11383 1.02021 1.36372 86.35432 0.22134 0.21785 0.81945 1.67413 59.01666 0.05333 0.15555 1.32064 1.14392 3.21405 0.48095 0.46169 2.01803 -0.85916 76.42164 0.00232 0.21510 0.88239 1.55644 84.05939 0.38746 0.09241 1.03807 1.49802 61.08616 0.40865 0.45244 1.73304 1.27895 68.19661 0.43435 0.48987 1.59916 1.50884 66.88192 0.04222 0.21943 1.16654 1.37700 35.30043 0.19989 0.05556 1.67229 0.33875 58.99301 0.12994 0.12903 1.37311 1.08118 15.40680 0.40003 0.20436 1.88439 -0.40392 63.54415 0.21571 0.29745 1.43481 1.29929 2.86496 0.45532 0.13111 1.68131 -0.86237 24.92307 0.09092 0.30142 1.88300 0.23440 4.15543 0.13190 0.35561 1.90078 -0.48544 8.74186 0.07277 0.11087 1.68263 -0.31065 74.11120 0.06803 0.05871 0.96481 1.35119 62.53458 0.43465 0.14834 1.58297 1.04053 28.53895 0.28985 0.15939 1.83473 0.11008 85.51998 0.27493 0.21208 0.89672 1.65209 3.10015 0.07248 0.25393 1.78677 -0.46653 39.48699 0.42652 0.04276 1.77733 0.27689 34.34026 0.31103 0.13124 1.80291 0.26160 68.89651 0.17548 0.40051 1.30693 1.53810 71.56799 0.25662 0.01461 1.18879 1.20559 16.81853 0.20090 0.46443 2.08509 -0.09151 44.07880 0.03798 0.36517 1.71079 0.92168 0.0 0.0 0.0 0.0 0.0 76.42164 0.00232 0.21510 0.88239 1.55644 84.05939 0.38746 0.09241 1.03807 1.49802 61.08616 0.40865 0.45244 1.73304 1.27895 68.19661 0.43435 0.48987 1.59916 1.50884 66.88192 0.04222 0.21943 1.16654 1.37700 35.30043 0.19989 0.05556 1.67229 0.33875 58.99301 0.12994 0.12903 1.37311 1.08118 15.40680 0.40003 0.20436 1.88439 -0.40392 63.54415 0.21571 0.29745 1.43481 1.29929 2.86496 0.45532 0.13111 1.68131 -0.86237 24.92307 0.09092 0.30142 1.88300 0.23440 4.15543 0.13190 0.35561 1.90078 -0.48544 8.74186 0.07277 0.11087 1.68263 -0.31065 74.11120 0.06803 0.05871 0.96481 1.35119 62.53458 0.43465 0.14834 1.58297 1.04053 28.53895 0.28985 0.15939 1.83473 0.11008 85.51998 0.27493 0.21208 0.89672 1.65209 3.10015 0.07248 0.25393 1.78677 -0.46653 39.48699 0.42652 0.04276 1.77733 0.27689 34.34026 0.31103 0.13124 1.80291 0.26160 68.89651 0.17548 0.40051 1.30693 1.53810 71.56799 0.25662 0.01461 1.18879 1.20559 16.81853 0.20090 0.46443 2.08509 -0.09151 44.07880 0.03798 0.36517 1.71079 0.92168 \end{filecontents*}   \documentclass[12pt]{article}  \usepackage{pgfplotstable} \pgfplotsset{compat=1.12} % <===========================================  \usepackage{booktabs} \usepackage{longtable}   \begin{document}  \pgfplotstableset{ begin table=\begin{longtable}, end table=\end{longtable}, }  \pgfplotstabletypeset[% col sep=space, %columns={theta1,r2v,r3v,x,y},      % display specified columns %columns/theta1/.style={fixed,fixed zerofill,precision=0,column type=r, %columns/r2v/.style={column type=l,precision=6,dec sep align, %columns/r3v/.style={fixed,fixed zerofill,precision=1,column type=r, %columns/x/.style={column type=l,precision=5,dec sep align, %columns/y/.style={column type=l,precision=5,dec sep align, % requires booktabs to place horiz rules every first row/.style={before row={% <=================================   \caption{This is a Table with Data}%   \label{tab:DataTable}\\   \toprule    \textbf{theta1} & \textbf{r2v} & \textbf{r3v} & \textbf{x} & \textbf{y} \\    \toprule     \endfirsthead % <=======================================================   \multicolumn{5}{c}{{\bfseries Table \thetable\ Continued from previous page}} \\   \toprule   \textbf{theta1} & \textbf{r2v} & \textbf{r3v} & \textbf{x} & \textbf{y} \\    \midrule \endhead % <============================================================   \midrule \multicolumn{5}{r}{{Continued on next page}} \\ \bottomrule \endfoot % <============================================================   \midrule   \multicolumn{5}{r}{{End of table}} \\ \bottomrule \endlastfoot % <======================================================== }}% ]{\jobname.dat}  \end{document}                  

and the result (first page):

first page

and the second page:

second page

With some changes on the first code of mine you can get the alignment you asked in the comment. Why I have to use && instead of & in the definition of the header I can't say. I guess that needs some deeper research in the code how the header is builded. Perhaps a question to the package maintainer ...

In the following MWE I leave out the filecontents part (copy it from the first code please) and see the marked changes:

          \documentclass[12pt]{article}  \usepackage{pgfplotstable} \pgfplotsset{compat=1.12} % <===========================================  \usepackage{booktabs} \usepackage{array} % <================================================== \usepackage{longtable}   \begin{document}  \pgfplotstableset{ begin table=\begin{longtable}, end table=\end{longtable}, %outfile={testtable.tex} % to check the resulting table code }  \pgfplotstabletypeset[% header=has colnames,        % true|false|has colnames  col sep=space, columns={theta1,r2v,r3v,x,y},      % display specified columns columns/theta1/.style={fixed,fixed zerofill,precision=0,column type=r,column name={$\theta_1$}}, columns/r2v/.style={column type=l,precision=6,dec sep align,column name={$r_{2v}$}}, columns/r3v/.style={fixed,fixed zerofill,precision=1,column type=r,column name={$r_{3v}$}}, columns/x/.style={column type=l,precision=5,dec sep align,column name={$x$}}, columns/y/.style={column type=l,precision=5,dec sep align,column name={$y$}}, % requires booktabs to place horiz rules every head row/.style={output empty row}, % <=========================== every head row/.append style={before row={% <===========================   \caption{The caption}\label{tab:DataTable}\\%   \toprule   \multicolumn{1}{c}{\textbf{theta1}} && \multicolumn{1}{c}{\textbf{r2v}} && \multicolumn{1}{c}{\textbf{r3v}} & \multicolumn{1}{c}{\textbf{x}} && \multicolumn{1}{c}{\textbf{y}} \\    \midrule \endfirsthead   \multicolumn{5}{c}{{\bfseries \tablename\ \thetable{} -- continued from previous page}} \\   \toprule   \multicolumn{1}{c}{\textbf{theta1}} && \multicolumn{1}{c}{\textbf{r2v}} && \multicolumn{1}{c}{\textbf{r3v}} & \multicolumn{1}{c}{\textbf{x}} && \multicolumn{1}{c}{\textbf{y}} \\    \midrule \endhead \midrule \multicolumn{5}{r}{{Continued on next page}} \\ \bottomrule \endfoot % <============================================================   \midrule   \multicolumn{5}{r}{{End of table}} \\ \bottomrule \endlastfoot % <======================================================== }, }% ]{\jobname.dat}  \end{document}                  

with the resulting pages 1:

enter image description here

and page 2:

enter image description here

fryarhatly1995.blogspot.com

Source: https://tex.stackexchange.com/questions/276422/continued-on-next-page-in-longtable-environment-part-2

0 Response to "Latex Longtable Continued on Next Page"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel