12

Many newspapers/newsletters have several articles starting on their front page, yet with only an initial segment of each article on the front page. Each such initial segment ends with a "jumpline" - a statement of the form "continued on page XX". The rest of the article would then appear on page XX.

Is there a way to do that in latex?

I could do it by hand, of course. But the idea is to allocate a certain number of front page inches for each topic, and then let latex automatically cut each topic at its allocated length and continue elsewhere.

My latex input may look as follows:

\ContinuedBox{A}{2in}{x1 x2 x3 ... x1000}
\ContinuedBox{B}{1in}{y1 y2 y3 ... y1000}
\newpage \Continuation{A}
\newpage \Continuation{B}

And then page 1 of the the output will be 2 inches of x1 x2 ... x100 (say) followed by "continued on page 2", followed by 1 inch of y1 y2 ... y50 (say) followed by "continued on page 3". Page 2 will have x101 through x1000, and page 3 will have y51 through y1000.

  • 1
    Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – user31729 Dec 29 '14 at 12:22
  • Have you looked into the packages newspaper or papertex? – user31729 Dec 29 '14 at 12:23
  • @ChristianHupfer do either of those packages do this (I didn't see anything in their doc, but could have missed something) – David Carlisle Dec 29 '14 at 12:43
  • @DavidCarlisle: I am unsure... it was just a guess... – user31729 Dec 29 '14 at 12:44
  • @Dror Bar-Natan: I've updated the package with non-floating 'continued' articles – user31729 Jan 4 '15 at 22:46
12

Update: 2015/06/02: I've uploaded the jumplines v0.2 package to CTAN -- it will soon available there and on TeXLive in a few weeks. The impatient reader can download it from my website.

Note: this is a preliminary solution Some caveats to be solved!

\documentclass[12pt,twocolumn]{article}



\usepackage{tcolorbox}%
\usepackage{blindtext}%
\usepackage{xcolor}%
\usepackage{hyperref}

\tcbuselibrary{breakable}

\newbox\articlebox%
\newbox\upperarticlebox%

\newlength{\articleboxheight}%

\newcounter{myarticle}


\newcommand{\FrontPageTeaser}[2]{%
\refstepcounter{myarticle}
\begingroup
\setlength{\articleboxheight}{#1}
\setbox\articlebox=\vbox{#2}

\setbox\upperarticlebox=\vsplit\articlebox to \articleboxheight

\begin{tcolorbox}[boxsep=0pt,boxrule=0pt,arc=0pt]%[lowerbox=ignored, lower separated=true,savelowerto=articlecontinued.cont]
\noindent\unvbox\upperarticlebox\par \label{myarticle::teaser::\number\value{myarticle}}
\flushright\textit{\bfseries Continued on Page \pageref{myarticle::\number\value{myarticle}}}
\end{tcolorbox}%

\begin{tcolorbox}[breakable,float=htb,boxsep=0pt,boxrule=0pt] 
\textit{\bfseries Continued from page \pageref{myarticle::teaser::\number\value{myarticle}}}
\noindent\unvbox\articlebox \label{myarticle::\number\value{myarticle}}
\end{tcolorbox}\par%
\endgroup
}%

\begin{document}


\clearpage


\FrontPageTeaser{3in}{\blindtext[5]}
\FrontPageTeaser{3in}{\textcolor{blue}{\blindtext[3]}}

\FrontPageTeaser{5in}{\textcolor{blue}{\blindtext[10]}}



\end{document}

enter image description here

Some improved version, but not finished

\documentclass[12pt,a4paper,twocolumn]{scrartcl}


\usepackage[svgnames]{xcolor}%

\usepackage[ngerman,english]{babel}
\usepackage[tmargin=2cm,bmargin=1.5cm]{geometry}
\usepackage[demo]{graphicx}%
\usepackage{scrpage2}
\usepackage{tcolorbox}%
\usepackage{blindtext}%
\usepackage{xparse}%
\usepackage{xkeyval}
\usepackage{afterpage}
\usepackage{hyperref}



\setcounter{totalnumber}{10}
\setcounter{topnumber}{3}
\setcounter{bottomnumber}{3}
\renewcommand{\floatpagefraction}{0.75}
\renewcommand{\floatpagefraction}{0.75}


\tcbuselibrary{breakable}

\makeatletter
\define@key{teasers}{TeaserHeadline}{%
  \def\TeaserMacroTeaserHeadline{#1}%
}%

\define@key{teasers}{TeaserHeight}[2in]{%
  \def\TeaserMacroTeaserHeight{#1}%
}%

\newcounter{issue}
\setcounter{issue}{1}

\afterpage{\clearpage}

\makeatother

\presetkeys{teasers}{TeaserHeight=2in}{}

\newbox\articlebox%
\newbox\teaserbox%

\newlength{\articleboxheight}%

\newcounter{myarticle}


\NewDocumentCommand\FrontPageTeaser{+o+m}{%
\refstepcounter{myarticle}
\begingroup%
\IfValueTF{#1}{%
  \setkeys{teasers}{#1}%
}{
  \typeout{Nothing!}
}
\setlength{\articleboxheight}{\TeaserMacroTeaserHeight}%
\setbox\articlebox=\vbox{\noindent#2}%
\setbox\teaserbox=\vsplit\articlebox to \articleboxheight% Split the input to teaser box and a continued box
\begin{tcolorbox}[breakable,boxsep=0pt,boxrule=0pt,left=0pt,right=0pt, arc=0pt,auto outer arc,colback=white,title={\ifdef{\TeaserMacroTeaserHeadline}{\TeaserMacroTeaserHeadline}{}}]
  \phantomsection\label{myarticle::teaser::\number\value{myarticle}}\unvbox\teaserbox\par%
  \vskip 0.3\baselineskip
  \raggedleft\textit{\bfseries Continued on Page \pageref{myarticle::\number\value{myarticle}}}
\end{tcolorbox}%
\begin{tcolorbox}[breakable,float=tbp,boxsep=0pt,left=0pt,boxrule=1pt,arc=0pt,auto outer arc,colback=white,colbacktitle=yellow,coltitle=black,break at=\textheight]% 
 \bfseries Continued from page \pageref{myarticle::teaser::\number\value{myarticle}}\par
 \phantomsection\label{myarticle::\number\value{myarticle}}%
 \noindent\unvbox\articlebox%
\end{tcolorbox}%
\endgroup
}%

\begin{document}
\pagestyle{scrheadings}
\clearscrheadings
\chead{\textbf{\large \TeX~StackExchange News}}%
\ihead{Issue \theissue}
\ohead{\today}


\FrontPageTeaser[TeaserHeight=2in,TeaserHeadline={Breaking News}]{\Large\textbf{egreg's reputation jumped over 5 billion yesterday}\par\begin{center}\includegraphics[scale=0.3]{bild_erwin_schroedinger}\end{center}\par
\blindtext[2]}%
\FrontPageTeaser[TeaserHeight=3in]{\textcolor{red}{\blindtext[10]}}%
\FrontPageTeaser[TeaserHeight=5in]{\textcolor{blue}{\selectlanguage{ngerman}\blindtext[10]}}%
\clearpage
\end{document}

enter image description here

First version of a package ## The colours only work together with lualatex!

\NeedsTeXFormat{LaTeX2e}%
\ProvidesPackage{jumplines}[2015/01/04 v0.1 -- Teaser/Continued articles with hyperlinks]
%%%
%% License: LaTeX Project Public License version 1.3 
%% Copyright (2015) Dr. Christian Hupfer 
%% Author: Christian Hupfer kontakt@siebenfelsen.de
%%
%%%%

\RequirePackage{etex}%
\RequirePackage{etoolbox}[2011/01/03 2.2]%
\RequirePackage{xparse}%
\RequirePackage{xkeyval}[2012/10/14 v2.6b]%
\RequirePackage[svgnames]{xcolor}
\RequirePackage[breakable]{tcolorbox}%

\RequirePackage{tocloft}
\RequirePackage{ifluatex}

\ifluatex
\RequirePackage{luacolor}%  Recommended
\fi


%%%% Key - Value definitions

\NewDocumentCommand{\listofarticlesname}{}{List of Articles}%
\newlistof{article}{art}{\listofarticlesname}%
\newlistof{contarticle}{cont}{\listofarticlesname}%




\define@key{jumpline}{ArticleHeadline}{%
  \def\JLKVMacroArticleHeadline{#1}%
}%

\define@key{jumpline}{ArticleAuthor}{%
  \def\JLKVMacroArticleAuthor{#1}%
}%

% Length related keys

\define@key{jumpline}{ArticleFullHeight}{%
  \def\JLKVMacroArticleFullHeight{#1}%
}%

\define@key{jumpline}{TeaserHeight}[2in]{%
  \def\JLKVMacroTeaserHeight{#1}%
}%

\define@key{jumpline}{ContinuedArticleHeight}{%
  \def\JLKVMacroContinuedArticleHeight{#1}%
}%

\define@key{jumpline}{ContinuedFromTopskip}{%
  \def\JLKVMacroContinuedFromTopskip{#1}%
}%
\define@key{jumpline}{ContinuedFromBottomskip}{%
  \def\JLKVMacroContinuedFromBottomskip{#1}%
}%

\define@key{jumpline}{ContinuedOnTopskip}{%
  \def\JLKVMacroContinuedOnTopskip{#1}%
}%

\define@key{jumpline}{ContinuedOnBottomskip}{%
  \def\JLKVMacroContinuedOnBottomskip{#1}%
}%

\define@key{jumpline}{ContinuedArticleBottomskip}{%
  \def\JLKVMacroContinuedArticleBottomskip{#1}%
}%

% Keys for optional teaser/continued article content and options

\define@key{jumpline}{TeaserHeaderContent}{%
  \def\JLKVMacroTeaserHeaderContent{#1}%
}%

\define@key{jumpline}{TeaserHeaderOptions}{%
  \def\JLKVMacroTeaserHeaderOptions{#1}%
}%

\define@key{jumpline}{ContinuedArticleHeaderContent}{%
  \def\JLKVMacroContinuedArticleHeaderContent{#1}%
}%


\define@key{jumpline}{ContinuedArticleHeaderOptions}{%
  \def\JLKVMacroContinuedArticleHeaderOptions{#1}%
}%

\presetkeys{jumpline}{TeaserHeight=2in,
                      ContinuedOnTopskip={0.4\baselineskip},
                      ContinuedOnBottomskip={0pt},
                      ContinuedFromTopskip={0.4\baselineskip},
                      ContinuedFromBottomskip={0pt},%
                      ContinuedArticleBottomskip={20pt},%
                      TeaserHeaderContent={},
                      TeaserHeaderOptions={breakable,leftlower=0pt,rightlower=0pt,boxrule=0pt,left=0pt,right=0pt, arc=0pt,auto outer arc,colbacktitle=black,coltitle=white,toptitle=2mm,bottomtitle=2mm,after={\parskip=0pt}},
                      ContinuedArticleHeaderOptions={breakable,leftlower=0pt,rightlower=0pt,boxsep=0pt,boxrule=0pt,left=0pt,right=0pt,arc=0pt,auto outer arc,colbacktitle=black,coltitle=white,toptitle=2mm,bottomtitle=2mm,righttitle=1mm}
                    }{}%




\newcounter{@@jumplines@@internaldocounter}%

\newlength{\@@jumplines@@articleheight}%
\newlength{\@@jumplines@@teaserboxheight}%


\xdef\ContinuedArticleList{}%
\xdef\TeaserBoxList{}%
\xdef\JumplineOptionsList{}%

\listcsadd{ContinuedArticleList}{}%
\listcsadd{TeaserBoxList}{}%
\listcsxadd{JumplineOptionsList}{}%



\NewDocumentCommand\JumplineArticle{+o+m}{%    Provide later on for a starred version
  \refstepcounter{article}%
  \newbox\articlebox%
  \newbox\teaserbox%
  \begingroup%
  \IfValueTF{#1}{%
    \setkeys{jumpline}{#1}%
  }{%
    \typeout{Nothing!}%
  }%
  \setlength{\@@jumplines@@teaserboxheight}{\JLKVMacroTeaserHeight}%
  \global\setbox\articlebox=\vbox{\noindent#2}%
  \setlength{\@@jumplines@@articleheight}{\the\ht\articlebox}%
  \global\setbox\teaserbox=\vsplit\articlebox to \@@jumplines@@teaserboxheight% Split the input to teaser box and a continued box 
  \listcsxadd{TeaserBoxList}{\number\teaserbox}%
  \listcsxadd{ContinuedArticleList}{\number\articlebox}%
  % Transfer options to the child box handlers
  \listcsxadd{JumplineOptionsList}{\unexpanded{#1},ContinuedArticleHeight={\the\ht\articlebox},ArticleFullHeight={\the\@@jumplines@@articleheight}}%
  \endgroup%
}%


\NewDocumentCommand{\DisplayJumplineTeaser}{+m+m}{%
  \begingroup%
  \setkeys{jumpline}{#1}%
  \begin{tcolorbox}[title={Article \thearticle~\ifdef{\JLKVMacroArticleHeadline}{\JLKVMacroArticleHeadline}{}},
    code={\pgfkeysalsofrom\JLKVMacroTeaserHeaderOptions}]
    \ifdef{\JLKVMacroTeaserHeaderContent}{%
      \JLKVMacroTeaserHeaderContent}{}%
  \end{tcolorbox}%
  \phantomsection%
  \label{jlarticle::teaser::\number\value{article}}%
  \ifdef{\JLKVMacroArticleHeadline}{%
    \addcontentsline{art}{section}{\thearticle~\JLKVMacroArticleHeadline}
  }{%
    \addcontentsline{art}{section}{\thearticle}%
  }%
  % Now unbox it
  \noindent\unvbox#2%
  \vskip\JLKVMacroContinuedOnTopskip%
  \ifdef{\JLKVMacroArticleAuthor}{\raggedleft By \JLKVMacroArticleAuthor\par}{}%
  \ifdimless{\JLKVMacroArticleFullHeight}{\JLKVMacroTeaserHeight}{%
  }{% 
    \raggedleft\textit{\bfseries Continued on Page \pageref{jlarticle::\number\value{article}}} % Change later on to be more configurable!
  }%
  \vskip\JLKVMacroContinuedOnBottomskip%
  \endgroup%
}%



\NewDocumentCommand{\DisplayContinuedArticle}{+m+m}{%
  \begingroup%
  \setkeys{jumpline}{#1}%
  \ifdimgreater{\JLKVMacroArticleFullHeight}{\JLKVMacroTeaserHeight}{%
    \begin{tcolorbox}[title={\raggedleft Continued from Article \ref{jlarticle::teaser::\number\value{article}} on page \pageref{jlarticle::teaser::\number\value{article}}},code={\pgfkeysalsofrom\JLKVMacroContinuedArticleHeaderOptions}]%
      \ifdef{\JLKVMacroContinuedArticleHeaderContent}{%
        \JLKVMacroContinuedArticleHeaderContent}{%
      }%
    \end{tcolorbox}%
    \phantomsection\label{jlarticle::\number\value{article}}%
    \ifdef{\JLKVMacroArticleHeadline}{%
      \addcontentsline{cont}{section}{\thearticle~\JLKVMacroArticleHeadline}%
    }{%
      \addcontentsline{cont}{section}{\thearticle}%
    }%
    \noindent\unvbox#2%
  }{}%
  \endgroup%
}%

\NewDocumentCommand{\@@jumplines@@showcontinuedarticle}{+m}{%
  \refstepcounter{article}%
  \begingroup%
  \setcounter{@@jumplines@@internaldocounter}{0}%
  \renewcommand{\do}[1]{%
    \stepcounter{@@jumplines@@internaldocounter}%
    \ifnumequal{\value{@@jumplines@@internaldocounter}}{\value{article}}{%
      \DisplayContinuedArticle{##1}{#1}%
      \listbreak%
    }{}}%
  \dolistcsloop{JumplineOptionsList}%
  \endgroup%
}%

\NewDocumentCommand{\@@jumplines@@showteaser}{+m}{%
  \refstepcounter{article}%
  \begingroup%
  \setcounter{@@jumplines@@internaldocounter}{0}%
  \renewcommand{\do}[1]{%
    \stepcounter{@@jumplines@@internaldocounter}%
    \ifnumequal{\value{@@jumplines@@internaldocounter}}{\value{article}}{%
      \DisplayJumplineTeaser{##1}{#1}%  
      \listbreak%
    }{%
      % Do nothing in this case
    }%
  }% End of \do definition
  \dolistcsloop{JumplineOptionsList}%
  \endgroup%
}%


\NewDocumentCommand{\ShipoutArticleTeasers}{}{%
  % Do it for safety reasons%
  \setcounter{article}{0}%
  \forlistcsloop{\@@jumplines@@showteaser}{TeaserBoxList}%
}%

\NewDocumentCommand{\ShipoutArticleHangingArticles}{}{%
  \setcounter{article}{0}%
  \forlistcsloop{\@@jumplines@@showcontinuedarticle}{ContinuedArticleList}%
}%

\endinput

Driver document

\documentclass[12pt,a4paper,twocolumn]{scrartcl}


\usepackage{graphicx}%
\usepackage{blindtext}%
\usepackage{jumplines}

\usepackage[bookmarksopen=true]{hyperref}


\begin{document}

\listofarticle
\listofcontarticle

\clearpage


\JumplineArticle[TeaserHeight=2in,ArticleHeadline={Breaking News}]{%
  \Large\textbf{Nothing special on the dark side of the moon}\par
  \begin{center}\includegraphics[scale=0.3]{example-image-a}\end{center}\par
  \blindtext[2]
}%
\JumplineArticle[TeaserHeight=2in,ArticleAuthor={Gandalf},ContinuedOnTopskip=1cm,ContinuedOnBottomskip=2cm,TeaserHeaderContent={A short article}]{\color{red}{\blindtext[10]}}%
\JumplineArticle[TeaserHeight=2in,ContinuedArticleHeaderContent={More information}]{\textcolor{blue}{\blindtext[1]\textcolor{Green}{Showing}\blindtext[2]}}%
\JumplineArticle[TeaserHeight=3in,ArticleHeadline={\Huge Breaking News}]{\Huge \sffamily The World is a Globe\par\begin{center}\includegraphics[scale=0.3]{example-image-b}\end{center}\par
  {\color{violet}{\( E = mc^2\)}}}%
\JumplineArticle[TeaserHeight=2in]{{{\color{brown}{\blindtext[10]}}}}%
\JumplineArticle[TeaserHeight=8in]{\textcolor{blue}{\blindtext[10]}}%
\JumplineArticle[TeaserHeight=2in]{\textcolor{Goldenrod}{\blindtext[10]}}%
\JumplineArticle[TeaserHeight=2in,ArticleAuthor={\textcolor{violet}{Some guy from the LaTeX3 - team}}]{\Huge \begin{center}\includegraphics[scale=0.2]{example-image-c}\end{center} \centering "I can't wait for \LaTeX3"}

\ShipoutArticleTeasers%

\clearpage

\ShipoutArticleHangingArticles%


\end{document}

enter image description here enter image description here

| improve this answer | |
  • The next update will include better links, ragged Continued ... stuff, color maintenance ;-) – user31729 Dec 29 '14 at 13:33
  • Will you make this into a package when you're done? – Ethan Bolker Dec 29 '14 at 21:19
  • 1
    @EthanBolker: Yes, I'll try to do so, but I'll struggle with those 'damned' (sorry) floats – user31729 Dec 29 '14 at 21:22
  • 1
    The reports about my reputation have been greatly exaggerated. – egreg Dec 30 '14 at 0:26
  • 1
    Reports are becoming grossly exaggerated! – egreg Dec 30 '14 at 21:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.