5

I am creating a two-page syllabus with a tikz calendar in the left column and all of the content on the right side of the page. Currently the right content is just like a normal article class document with the left margin adjusted by the geometry package to avoid overlapping the absolutely positioned tikz calendar.

Question: Is there any way in (Xe)Latex to put the two columns into environments, such that whatever I put in on the left column is completely independent from the right and vice versa, which would effectively lock the tikz pictures to pages, ignoring the right side content.

My Goal: A master document for all of my syllabi, where the right side content is simply an \input{thecontent}. The left side will be a tikz calendar (one on the first page, one on page 2)

Problem: I have a master document, but if the right column content (the \input{content}) is a shorter document or more likely a longer document, I have to keep moving the tikzpicture environment around in order to get the calendars on the left side of the page. Text seems to push them to the next page.

NOTE: Currently, the tikzpicture environments are positioned absolutely on the page.

--------------->

\documentclass[10pt]{article}
\usepackage{fontspec}

%CUSTOM VARIABLES
\newcommand{\content}{./"Winter2012/Listening and Speaking 1/Listening_and_Speaking_1_Syllabus"}
%UNUSED COMMANDS, BUT PERHAPS USEFUL LATER
\newcommand{\institution}{Universität Innsbruck}
\newcommand{\department}{Institut der Anglistik}
\newcommand{\class}{Listening \& Speaking I}
\newcommand{\designation}{SL/2}
\newcommand{\ECTS}{ECTS: 2.5}
\newcommand{\hours}{[W 10.00-12.00]}
\newcommand{\office}{}

%SET MARGINS (AND PAGE DIMENSIONS)
\usepackage[top=2.8cm,bottom=2cm,left=7cm,right=2cm,head=30pt]{geometry}

\usepackage{wrapfig}

%USE THISPAGESTYLE{EMPTY} BELOW MAKETITLE OR {FANCY}
\usepackage{tikz}
\usetikzlibrary{shapes,calendar,mindmap,patterns}
\usepackage{everypage} % put something on every page

%HEADER FOOTER
\usepackage{fancyhdr}
\lhead{} \chead{\textsc{}} \rhead{\textsc{{\Huge\class}\\\institution} }
\lfoot{\textsc{J. Komar}} \cfoot{\textsc{}} \rfoot{\textsc{\today}}
\renewcommand{\headrulewidth}{0.0pt} 
\renewcommand{\footrulewidth}{0.0pt}
%\renewcommand{\headersep}{5cm}
\pagestyle{fancy}%ADD HEADER FOOTER TO PAGE EXCEPT TITLE PAGE
%USE THISPAGESTYLE{EMPTY} BELOW MAKETITLE OR {FANCY}
\usepackage{lipsum}%To generate test text, use \lipsum[#NUMOFLINES#] in body

%\newcommand\event[2]{\ifdate{equals=#1} {\node [anchor=north west, text width=3.5cm,event]{#2}; 
\newcommand\event[2]{
    \ifdate{equals=#1} {
% In the following, the event nodes are defined
% The \rule in the node text is necessary to match the "text depth=0.5ex" of the date nodes
        \node [yshift=6pt,xshift=5pt,anchor=west,text height=1.5ex, text width=3.5cm,event]{#2}; 
    }{}
}

\newcommand\redevents{
    \tikzstyle{event}=[black,fill=red!10]
    %\event{2012-10-31}{This is a very long event text running over three lines.}
    %\event{2012-11-07}{Short event!}
    %\event{2012-11-14}{Third of the longish events\ldots}
}

\usepackage{enumitem}
\setlist{nolistsep}
\begin{document}%BEGIN DOCUMENT
%BACKGROUNDS
\AddEverypageHook{ % on every page...ensure \usepackage{everypage} in header
\begin{tikzpicture}[remember picture, overlay]
\node[xshift=1.8cm] at (current page.north west) {\begin{tikzpicture}[remember picture,overlay,fill opacity=0.5]\path[fill=yellow!15] (0,0) rectangle (4.5cm,-\paperheight);\end{tikzpicture}};
\node[yshift=-.5cm,xshift=0cm] at (current page.north west) {\begin{tikzpicture}[remember picture, overlay]\path[fill=blue!15] (0,0) rectangle (\paperwidth,-2cm);
\end{tikzpicture}};
\end{tikzpicture}
}

\begin{wrapfigure}{l}{0.5cm}
\tiny
\begin{tikzpicture}[remember picture]
\path[use as bounding box] (0,0) rectangle (1,1); % adjust to fit
\node[xshift=2.2cm,yshift=-3.5cm](NW) at (current page.north west) {};
  \calendar [day list downward,
              month text=\%mt\ \%y0,
              month yshift=5em,
              name=cal,
              dates=2012-10-01 to 2012-12-last,
              at={(NW)},
              every day/.style={
                   anchor=mid,
                   text depth=0.5ex,
                   text height=1.5ex,
                   text width=.3cm,
                   align=center},
             execute after day scope={
                   \redevents
              }
              ]
    if (Wednesday) {\draw[black] (0,0) circle (4pt);}
    if (weekend) [transparent!0]
    if (day of month=1) {
      \node at (0pt,2em) [anchor=base west,color=black] {\small\tikzmonthtext};
      \draw[anchor=north,yshift=8pt] (0,0)--(4,0);
};
\end{tikzpicture}
\end{wrapfigure}

\input{\content}%inputted right column

%%%%%%%%%%%%%%%%END OF CONTENT

\begin{wrapfigure}{r}{0.5cm}
\tiny
\begin{tikzpicture}[remember picture]
\path[use as bounding box] (0,0) rectangle (1,1); % adjust to fit

\node[xshift=2.2cm,yshift=-3.5cm](NW) at (current page.north west) {};
  \calendar [day list downward,
              month text=\%mt\ \%y0,
              month yshift=5em,
              name=cal,
              dates=2013-01-01 to 2013-02-last,
              at={(NW)},
              every day/.style={
                   anchor=mid,
                   text depth=0.5ex,
                   text height=1.5ex,
                   text width=.3cm,
                   align=center},
             execute after day scope={
                   \redevents
              }
              ]
    if (Wednesday) {\draw[black] (0,0) circle (4pt);}
    if (weekend) [transparent!0]
    if (day of month=1) {
      \node at (0pt,2em) [anchor=base west,color=black] {\small\tikzmonthtext};
      \draw[anchor=north,yshift=8pt] (0,0)--(4,0);
};
\end{tikzpicture}
\end{wrapfigure}

\end{document}

enter image description here

3
  • have you looked at the parcolumns package?
    – cmhughes
    Commented Aug 5, 2012 at 18:28
  • No, but I will look into it. Commented Aug 5, 2012 at 18:57
  • I cannot get the \newpage or \clearpage command to work within the "\colchunk {" of the parcolumns environment. Do you know how I could do this? If you have the time, could you make a full answer with example? Commented Aug 5, 2012 at 19:23

1 Answer 1

5

Not sure if parcolums package is appropiate in this case, because you have to define some kind of synchronization between columns (since the purpose of the package is to have two columns whose content runs in parallel, as in bilingual texts).

If what you want is to have two completly independent columns, each one with its own "flow" of text, the easiest solution I can imagines is to have each column typeset in a separate document (with a paperwidth and paperheight equal to the dimensions of each column), and then combine both documents into a single one via \includegraphics, taking one page of each one and putting them side to side.

The following MWE implements this idea. It is not a complete solution, since it assumes that both documents have the same length (in pages), but it serves to illustrate the idea.

First, save the following in a file called column1.tex, and compile it to get column1.pdf:

\documentclass{article}
\usepackage[paperwidth=6cm, paperheight=23cm, margin=0cm]{geometry}
\usepackage{lipsum}
\begin{document}\sloppy\small
\lipsum[1-15]
\end{document}

The first page of this document would look as follows:

Column1

The, typeset the second column in a file called column2.tex, and compile it to get column2.pdf:

\documentclass{article}
\usepackage[paperwidth=10cm, paperheight=23cm, margin=0cm]{geometry}
\usepackage{lipsum}
\begin{document}
\lipsum[1-20]
\end{document}

whose first page looks like this:

Column2

Finally, the following document combines the two previous:

\documentclass{article}
\usepackage[margin=2cm]{geometry}
\usepackage{graphicx}
\input{repeat}
\begin{document}
\repeat\for{pag}\by{1}\from{1}\to{4}
\do{
\noindent\includegraphics[page=\the\pag]{column1}%
\hfill\includegraphics[page=\the\pag]{column2}%
\clearpage
}
\end{document}

The first and last page of this document look as follows:

First page Last page

UPDATE: The following version of the code which "merges" the two colums now is much more general, adapting itself automatically to the number of pages of each column, stopping the output of the one which ends first and continuing only with the other:

\documentclass{article}
\usepackage[margin=2cm]{geometry}
\usepackage{graphicx}
\usepackage{pdfpages}
\input{repeat}
\begin{document}
\pdfximage{column1.pdf}
\edef\pagfirst{\the\pdflastximagepages}
\pdfximage{column2.pdf}
\edef\pagsecond{\the\pdflastximagepages}
\ifnum\pagfirst>\pagsecond
\edef\maxpag{\pagfirst}
\else
\edef\maxpag{\pagsecond}
\fi
\repeat\for{pag}\by{1}\from{1}\to{\maxpag}
\do{
\ifnum\the\pag>\pagfirst\relax\else%
\noindent\includegraphics[page=\the\pag]{column1}%
\fi%
\ifnum\the\pag>\pagsecond\relax\else%
\hfill\includegraphics[page=\the\pag]{column2}%
\fi
\clearpage
}
\end{document}
1
  • Good, well-described answer. Although your answer will most likely be a solution (haven't tried it yet), I will leave the question open, because introducing a third .tex file is not what I had hoped for. I would like to see if anyone else comes up with a better solution. Also, could you clarify MWE? This it hardly important for your answer, but for the sake of completeness, I inclined to ask! Commented Aug 6, 2012 at 6:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .