1

I would like to thank you all for any help in advance.

Might I ask the following question? I am creating a translator document with 2 columns (as you can see in the code).

I used the parallel package. Not because I know anything about the best package for this, but simply because I found a working code on the net. If you have any advice on a better package to use, or a better way of coding these columns, please let me know. Especially since I want to have "nested" columns. See code: (table test). I am using tabulars now to do this. Does anyone know any better way, for example using options in the parallel package? In the future I will also be needing a nested 3-column table if possible.

About this I have my actual question, namely: I would like a vertical line in between the nested column. Right now I drew the line with tikz piciture, also only just because that's the only way I know to get a continuous vertical line. But my code is not giving the right result: the line is inside a parallel-package-"paragraph", and therefore the following paragraph gets shifted a lot down vertically. Using \vspace{-...cm} is not very practical, since adjustments need to be made every time the translation changes... Thanks for any optimization help. For example, I tried using three columns inside the tabular (the middle one empty), but then I have no clue of how to draw a continuous vertical line in the middle (2nd) empty column. Thanks for any help again.

I am using the following code:

\documentclass{article}

\usepackage{tikz} % to draw a vertical line

\usepackage[margin=0.5in]{geometry}
\usepackage{parallel}
\usepackage{framed}
\setlength{\FrameSep}{0.1cm} % to create parallel translator columns

\usepackage{calc}\setlength\textwidth{8.3in}\setlength\textheight{10.9in}\setlength\oddsidemargin{(\paperwidth-\textwidth)/2 - 1in}\setlength\topmargin{(\paperheight-\textheight-\headheight-\headsep-\footskip)/2 - 1in} % to adjust page boundaries

\newcommand\Par[2]{\begin{Parallel}[v]{10.2cm}{10.2cm}
\ParallelLText{#1}\ParallelRText{#2}\ParallelPar\end{Parallel}}\setlength{\columnseprule}{.4pt} % to create parallel translator columns

\begin{document}

\begin{framed}

\Par % new paragraph
{ % left <<<
\raggedright
\quad \quad Test test test Test test test Test test test Test test test Test test test Test test test Test test test Test test test Test test test Test test test Test test test Test test test Test test test Test test test Test test test Test test test.
} % >>> left
{ % right <<<
\raggedright
\quad \quad Test test test Test test test Test test test Test test test Test test test Test test test Test test test Test test test Test test test Test test test Test test test Test test test Test test test Test test test Test test test Test test test.
} % >>> right

\Par % new paragraph
{ % left <<<
\raggedright
\quad \quad Test test test Test test test Test test test Test test test Test test test Test test test Test test test Test test test Test test test Test test test Test test test Test test test Test test test Test test test Test test test Test test test.
} % >>> left
{ % right <<<
\raggedright
\quad \quad Test test test Test test test Test test test Test test test Test test test Test test test Test test test Test test test Test test test Test test test Test test test Test test test Test test test Test test test Test test test Test test test.
} % >>> right

\raggedright
\rule{\textwidth}{0.4pt} % new page

\Par % new paragraph
{ % left <<<
\centering
\scalebox{0.55}[0.55]{page x} % page numbering
} % >>> left
{ % right <<<
\centering
\scalebox{0.55}[0.55]{page x} % page numbering
} % >>> right

\Par % new paragraph
{ % left <<<
\raggedright
\quad \quad Test test test Test test test Test test test Test test test Test test test Test test test Test test test Test test test Test test test Test test test Test test test Test test test Test test test Test test test Test test test Test test test.
} % >>> left
{ % right <<<
\raggedright
\quad \quad Test test test Test test test Test test test Test test test Test test test Test test test Test test test Test test test Test test test Test test test Test test test Test test test Test test test Test test test Test test test Test test test.
} % >>> right

\raggedright
\rule{\textwidth}{0.4pt} % new page

\begin{tikzpicture}
\hspace{5cm}
\draw (1,0) -- (1,5);
\end{tikzpicture}

\Par % new paragraph
{ % left <<<
\centering
TABLE TEST \\
\line(1,0){40} \\
} % >>> left
{ % right <<<
\centering
TABLE TEST \\
\line(1,0){40} \\
} % >>> right

\Par % new paragraph
{ % left <<<
\raggedright
\begin{tabular}{p{0.5cm}p{5cm}p{1cm}}
& \scalebox{0.8}[0.8]{{\sc{Element one}}} & \scalebox{0.8}[0.8]{{\sc{Element b-one}}}
\end{tabular} \\
} % >>> left
{ % right <<<
\raggedright
\begin{tabular}{p{0.5cm}p{5cm}p{1cm}}
& \scalebox{0.8}[0.8]{{\sc{Element two}}} & \scalebox{0.8}[0.8]{{\sc{Element b-two}}}
\end{tabular}
} % >>> right

\Par % new paragraph
{ % left <<<
\raggedright
\begin{tabular}{p{0.5cm}p{5cm}p{1cm}}
& \scalebox{0.8}[0.8]{{\sc{Element one}}} & \scalebox{0.8}[0.8]{{\sc{Element b-one}}}
\end{tabular} \\
} % >>> left
{ % right <<<
\raggedright
\begin{tabular}{p{0.5cm}p{5cm}p{1cm}}
& \scalebox{0.8}[0.8]{{\sc{Element two}}} & \scalebox{0.8}[0.8]{{\sc{Element b-two}}}
\end{tabular}
} % >>> right

\Par % new paragraph
{ % left <<<
\raggedright
\begin{tabular}{p{0.5cm}p{5cm}p{1cm}}
& \scalebox{0.8}[0.8]{{\sc{Element three}}} & \scalebox{0.8}[0.8]{{\sc{Element b-three}}}
\end{tabular} \\
} % >>> left
{ % right <<<
\raggedright
\begin{tabular}{p{0.5cm}p{5cm}p{1cm}}
& \scalebox{0.8}[0.8]{{\sc{Element three}}} & \scalebox{0.8}[0.8]{{\sc{Element b-three}}}
\end{tabular}
} % >>> right

\Par % new paragraph
{ % left <<<
\raggedright
\begin{tabular}{p{0.5cm}p{5cm}p{1cm}}
& \scalebox{0.8}[0.8]{{\sc{Element ...}}} & \scalebox{0.8}[0.8]{{\sc{Element b-...}}}
\end{tabular} \\
} % >>> left
{ % right <<<
\raggedright
\begin{tabular}{p{0.5cm}p{5cm}p{1cm}}
& \scalebox{0.8}[0.8]{{\sc{Element ...}}} & \scalebox{0.8}[0.8]{{\sc{Element b-...}}}
\end{tabular}
} % >>> right

\end{framed}

\end{document}
8
  • 1
    Welcome to the site. If you indent your code by 4 spaces, it displays as code. This can be easily accomplished by highlighting the unindented code and clicking on the {} icon atop the edit box. Inline code can be represented as code by delimiting it with backticks (aka grave accents). Dec 10, 2014 at 14:17
  • Thanks a lot for the explanation! I got the hang of it now.
    – O0123
    Dec 10, 2014 at 14:20
  • Tabulars are easy: {|p{0.5cm}|p{5cm}|p{1cm}|} To draw between columns you need to use the [remember picture,overlay] option of tikz. Check out pgfpagenodes. Dec 10, 2014 at 14:31
  • You could also use \rule and things like \rlap, \llap, \smash and \raisebox. Dec 10, 2014 at 14:34
  • Finally, I would reccomend the paracol package instead. To create three columns, use \begin{paracol}{3} Dec 10, 2014 at 14:42

1 Answer 1

1

This answer is not pretty, but may get you where you need to be. It is a pure tabular (and tabular*) solution, though I wrap things up in the environments partabular and nextentry. The environment partabular sets some parameters and should delimit the whole table.

The environment nextentry can be successively called to build your table. Because it is composed of a tabular*, one "entry" can (but does not need to) have multiple lines; however page breaking can only occur between invocations of nextentry. Don't add an \hline to the last row of a nextentry, because the environment does it for you automatically.

I show how one can build a tabular within a cell that effectively subdivides it vertically. The downside is that, if the split column is not the longest in its row, you must use the macro \filllines{} to extend the vertical bar to the bottom of the overall containing cell.

Another quirk: the length delfix is the vertical space that would normally appear between adjecent tabular* blocks. Defining \delfix allows that length to be subtracted off, so that the top line of the 2nd tabular* overlays the bottom line of the 1st. Turning on \raggedbottom in the preamble should keep glue from interfering with this measurement.

The MWE is set up for two columns. To extend to 3, the lengths \colwidth and \splitcolwidth will need redefinition.

\documentclass{article}
\usepackage{lipsum}
\def\lipsA{%
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit,
vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida
mauris. Nam arcu libero, nonummy eget, consectetuer id, vulputate a, magna.}
\def\lipsB{%
Donec vehicula augue eu neque. Pellentesque habitant morbi tristique senectus
et netus et malesuada fames ac turpis egestas. Mauris ut leo. Cras viverra
metus rhoncus sem. Nulla et lectus vestibulum urna fringilla ultrices. Phasellus
eu tellus sit amet tortor gravida placerat. Integer sapien est, iaculis in, pretium
quis, viverra ac, nunc. Praesent eget sem vel leo ultrices bibendum. }
\def\lipsC{%
Aenean faucibus. Morbi dolor nulla, malesuada eu, pulvinar at, mollis ac, nulla. Cur-
abitur auctor semper nulla. Donec varius orci eget risus. Duis nibh mi, congue
eu, accumsan eleifend, sagittis quis, diam. Duis eget orci sit amet orci dignissim
rutrum.}
\newlength\svparskip
\newlength\delfix
\delfix1.3pt
\newlength\colwidth
\setlength\colwidth{\dimexpr.5\textwidth-2\tabcolsep}
\newlength\splitcolwidth
\setlength\splitcolwidth{\dimexpr.25\textwidth-2\tabcolsep}
\newenvironment{partabular}
  {\par\svparskip=\parskip\relax\vspace{\delfix}}
  {\vspace{\delfix}\parskip=\svparskip\relax}
\newenvironment{nextentry}
  {\parskip-\delfix\par\noindent\begin{tabular*}{\textwidth}[t]
  {|p{\colwidth}|p{\colwidth}|}\hline}{\hline\end{tabular*}\par}
\def\filllines#1{\vspace{\dimexpr#1\ht\strutbox+#1\dp\strutbox}}
\raggedbottom
\begin{document}
\lipsum[1]
\begin{partabular}
\begin{nextentry}
a & b\\\hline
c & d\\\hline
\lipsA & \lipsB\\
\end{nextentry}
\begin{nextentry}
F & G\\\hline
  \begin{tabular}[t]{@{}p{\splitcolwidth}|p{\splitcolwidth}@{}}
  This is a test of a split column \filllines{6}& X 
  \end{tabular} 
& \lipsC\\
\end{nextentry}
\begin{nextentry}
\lipsA & \lipsC\\
\end{nextentry}
\begin{nextentry}
F & G\\\hline
\lipsB & \lipsC\\\hline
\lipsA & \lipsC\\
\end{nextentry}
\begin{nextentry}
F & G\\\hline
\lipsB & \lipsC\\
\end{nextentry}
\begin{nextentry}
\lipsA & \lipsC\\
\end{nextentry}
\end{partabular}
\end{document}

enter image description here

If you are unhappy with the part of the solution in which two horizontal lines are made to overlay through the use of the \delfix parameter, then an alternative definition would be

\newenvironment{nextentry}[1][\relax]
  {\parskip-\delfix\par\noindent\begin{tabular*}{\textwidth}[t]
    {|p{\colwidth}|p{\colwidth}|}\ifx\relax#1\relax\else\hline\fi}
  {\hline\end{tabular*}\par}

This will print an \hline at the beginning of a table only if a non-blank optional argument is provided to nextentry in the manner of

\begin{nextentry}[x]
a & b\\\hline
c & d\\\hline
\lipsA & \lipsB\\
\end{nextentry}

The downside of this alternate approach is that you have to manually add an optional argument to the first nextentry block on each page of output. Uncontrolled repagination would make you very unhappy in this case.

You must log in to answer this question.

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