我有各种长度的选项,所以有时它们会超出页面。 csvreader 上是否有类似分页的选项longtable
?
示例代码:
\documentclass[a4paper,12p]{article}
%%% select the required data %%%%
% select hospital name
\newcommand{\hospital} {Hospital}
%Pricelist name
\newcommand{\pricelist}{RFD_MTSV}
%%%%%%% DON'T ALTER FROM HERE ONWARDS (except spacing and layout)%%%%
\newcommand{\system}{\csvreader[filter equal={\csvcoli}{2}]{\excel}{2=\sys}{\sys}}
\newcommand\systemf{\csvreader[filter equal={\csvcoli}{2}]{\excel}{2=\sys}{\edef\MySystem{\sys}}}
\usepackage{graphicx} %% allow graphics
\usepackage{xcolor} %% allow colour
\definecolor{teal}{RGB}{76,177,155}
\definecolor{light-gray}{gray}{0.4}
\usepackage[textwidth=450pt, textheight=680pt,top=3cm, left=2.5cm]{geometry} %margins
\usepackage{fancyhdr} %% allow header, footer
\setlength{\headheight}{15.2pt}
\pagestyle{fancy}
\fancyhf{}
\fancyheadoffset{1 cm}
\fancyfootoffset{1 cm}
\lhead{\textcolor{teal} {\monthyeardate\today}}
\chead{\textcolor{light-gray}{\hospital \, (System)}}
\rhead{\textcolor{light-gray} {page \thepage}}
\lfoot{\textcolor{light-gray} {38 years }}
\rfoot{\bfseries \textcolor{light-gray} {Company}}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}
\fancypagestyle{firstpage}{% first page different
\lhead{}
\chead{}
\rhead{}
\renewcommand{\headrulewidth}{0pt}
\lfoot{\textcolor{light-gray} {38 years}}
\rfoot{\bfseries \textcolor{light-gray} {Company}}
\renewcommand{\footrulewidth}{0.4pt}}
\usepackage{datetime} % dates - my altered dates below
\newdateformat{monthyeardate}{%
\monthname[\THEMONTH] \THEYEAR} %just month written and Year
\newdateformat{normal}{%
\longdate \ordinaldate{\THEDAY} \monthname[\THEMONTH] \THEYEAR} %normal date
\newcommand\twodigits[1] {\ifnum#1<10 0#1\else #1\fi}
\newdateformat{quoteNo}{%
\THEYEAR--\twodigits{\THEMONTH}--\twodigits{\THEDAY} } % digit date for quote no.
\usepackage{fontawesome} % phone symbols
\usepackage{marvosym} % LinkedIn and Facebook symbols
\usepackage{hyperref} %hyperlinks
\usepackage{tabularx} % for the table format
\newcommand\mce{\multicolumn{1}{c}{}}
\newcounter{RowNum}
\usepackage{siunitx} %counting row numbers
\usepackage{advdate} % quote expiry
\usepackage[none]{hyphenat} % don't hyphenate
\usepackage{csvsimple} % read Excel tables
\newcommand{\excel} {\pricelist.csv}
\newcommand{\comma}{, }
\newcommand{\commano}{,}
\newcommand{\nc}{&}
\newcommand{\ns}{\,}
\usepackage{enumitem} % dot points with indent
\newenvironment{myitemize}{%
\itemize[leftmargin=!,labelindent=5pt,itemindent=-10pt]
}{%
\enditemize
}
\usepackage{longtable} %table over 2 pages
\begin{document}
\setlength{\parindent}{0pt} % never indent first line
\color{light-gray}{%
\subsubsection*{\underline{OPTIONAL ITEMS AVAILABLE}}
\vspace{0.4cm} % adjust spacing here
%\begin{longtable} %doesn't work
\csvreader[tabular = >{\stepcounter{RowNum}\theRowNum}r >{\everypar{\hangindent0.7cm}}p{12cm} b{1.3cm}, filter ifthen=\equal{\csvcolii}{1}]{\excel}{17=\dbo, 18=\deo, 15=\pricel,16=\pricer}{& \textbf{\dbo} \deo & \mce \\
\mce && \$ \hfill \ifthenelse{\equal{\pricel}{0}}{}{\pricel,}\pricer \\ \mce}
%\end{longtable}
}
\color{black}
%\hrulefill %remove if necessary
%\vspace{-0.1cm} % adjust spacing here
\textbf{Delivery Time:} Approximately 8 weeks after placement of order\\
\textbf{Payment terms:} Full payment is required no later than 30 days from date of installation. \\
\begin{minipage}{1cm}{} \end{minipage}\hspace{1cm}\begin{minipage}[t]{0.01cm}{\footnotesize{*}} \end{minipage}\hspace{-0.7cm}\begin{minipage}[t]{15cm} {\begin{quote} \footnotesize{Any moneys outstanding after this period will be charged at 20\,\% interest from the date of delivery.} \end{quote}}\end{minipage}\\
\textbf{GST:} Unless otherwise stated, all prices in this quote are excluding GST.\\
\textbf{Quotation expiry:}\normal{\AdvanceDate[28] \today}
\end{document}
答案1
我发现,一个简单的交换就可以分割页面:
\csvreader[longtable= >{\stepcounter{RowNum}\theRowNum}r >{\everypar{\hangindent0.7cm}}p{12cm} b{1.3cm}, filter ifthen=\equal{\csvcolii}{1}]{\excel}{17=\dbo, 18=\deo, 15=\pricel,16=\pricer}{& \textbf{\dbo} \deo & \mce \\
\mce && \$ \hfill \ifthenelse{\equal{\pricel}{0}}{}{\pricel,}\pricer \\ \mce}
我很乐意听取有关如何实现标题的评论(不是针对这个例子),但正在进行另一个项目......