我需要生成随机文本,如果随机文本 = \textheight
,则自动分页并在相同环境中使用其余文本开始新页面textblock
。我读了很多文章,但最大的问题是绝对定位,它会忽略除 之外的所有内容\null\newpage
。请帮帮我!
我有代码:
\documentclass[a4paper]{letter}
%define used packages
\usepackage{setspace}
\usepackage{xcolor}
\usepackage{graphicx}
\usepackage{pagecolor}
\usepackage[absolute,overlay]{textpos}
\usepackage{helvet}
\usepackage{multicol}
\usepackage[left=2cm, top=1.5cm, right=1cm, bottom=2cm, includehead]{geometry}
\usepackage{eso-pic}
%specify layout settings
\voffset = 0pt
\hoffset = 0pt
\headheight = 45pt
\headsep = 0.5cm
\footskip = 0.5cm
\oddsidemargin = -14pt
\pagecolor{white}
\setlength\columnsep{38pt}
%define custom colors
\definecolor{MySpecColor}{RGB}{245,247,246}
\definecolor{MySpecTitleColor}{RGB}{249,206,143}
\definecolor{MySpecHeaderColor}{RGB}{221,130,0}
%create new commands
\newcommand{\parallelcolor}{ %
\color{black}\small\onehalfspacing
}
\newcommand{\changecolor}{%
\color{MySpecTitleColor}
}
\newcommand{\redefinecolor}{%
\color{black}
}
\newcommand{\redefineweight}{%
\bf
}
\newcommand{\setownstyle}{
% \rmfamily
\LARGE\color{black}
}
\newcommand{\setownspecstyle}{
%\rmfamily
\LARGE\color{MySpecHeaderColor}
}
%define renewcommands
\renewcommand{\rmdefault}{phv}
\renewcommand{\sfdefault}{phv}
\AddToShipoutPictureBG{%
\AtTextLowerLeft{\color{MySpecColor}%
\rule{\textwidth}{\textheight}}}
%define mainpart of document
\begin{document}
\begin{textblock}{12}(2.2,2.5)
\setownstyle Text\\[0pt]
\setownstyle Text\\[0pt]
\setownspecstyle Text
\begin{spacing}{1.3}
\begin{multicols}{2}{
\parallelcolor Text
\vfill
\columnbreak
\parallelcolor Text
}
\end{multicols}
\begin{spacing}{0.7}
\begin{multicols}{2}{
\parallelcolor Text
\vfill
\columnbreak
\parallelcolor Text
}
\end{multicols}
\end{spacing}
\end{spacing}
\end{textblock}
\end{document}
答案1
也许我没有理解这个问题,而且这个评论太长了,所以我暂时将其作为答案。
删除文本块环境后事情似乎按预期进行,如以下示例所示(在我的示例代码中我删除了一些不相关的包和设置):
\documentclass[a4paper]{letter}
\usepackage{setspace}
\usepackage{helvet}
\usepackage{multicol}
\usepackage[left=2cm, top=1.5cm, right=1cm, bottom=2cm, includehead]{geometry}
\usepackage{eso-pic}
\usepackage{lipsum}% just to generate text for the example
\setlength\columnsep{38pt}
%define custom colors
\definecolor{MySpecColor}{RGB}{245,247,246}
\definecolor{MySpecTitleColor}{RGB}{249,206,143}
\definecolor{MySpecHeaderColor}{RGB}{221,130,0}
%create new commands
\newcommand{\parallelcolor}{ %
\color{black}\small\onehalfspacing
}
\newcommand{\changecolor}{%
\color{MySpecTitleColor}
}
\newcommand{\redefinecolor}{%
\color{black}
}
\newcommand{\redefineweight}{%
\bf
}
\newcommand{\setownstyle}{
% \rmfamily
\LARGE\color{black}
}
\newcommand{\setownspecstyle}{
%\rmfamily
\LARGE\color{MySpecHeaderColor}
}
%define renewcommands
\renewcommand{\rmdefault}{phv}
\renewcommand{\sfdefault}{phv}
\AddToShipoutPictureBG{%
\AtTextLowerLeft{\color{MySpecColor}%
\rule{\textwidth}{\textheight}}}
\AddToShipoutPictureBG{%
\AtTextLowerLeft{\color{MySpecColor}%
\rule{\textwidth}{\textheight}}}
%define mainpart of document
\begin{document}
\setownstyle Text\\
\setownstyle Text\\
\setownspecstyle Text
\begin{spacing}{1.3}
\begin{multicols}{2}{
\parallelcolor Text
\vfill
\columnbreak
\parallelcolor Text
}
\end{multicols}
\begin{spacing}{0.7}
\begin{multicols}{2}{
\parallelcolor Text
\vfill
\columnbreak
\parallelcolor Text
}
\end{multicols}
\end{spacing}
\end{spacing}
\lipsum[1-5]
\end{document}