Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I want to divide a paragraph with enumerate. First I use package "parallel":

\documentclass{article}
\usepackage{color}
\usepackage{parallel}
\begin{document}

\begin{Parallel}{0.45\textwidth}{0.45\textwidth}
\ParallelLText{
    \textcolor{red}{Bonds}
    \begin{enumerate}
        \item Not a share of ownership
        \item Fixed maturity
    \end{enumerate}
}
\ParallelRText{
    \textcolor{red}{Stocks}
    \begin{enumerate}
        \item Not a share of ownership
        \item Fixed maturity
    \end{enumerate}
    }
\ParallelPar
\end{Parallel}

\end{document}

So the two items do not appear under the two columns. They just appear on the left hand side.

enter image description here

I don't know how to fix it. And with the package paracol, I don't know how to create a vertical line between coloums.

Can anyone help me?

If you know any package better than those packages please let me know.


@Heiko Oberdiek: I still have a problem with vertical problem when i use both packages: hyperref and pdfcolparallel. Here is my code:

\documentclass[12pt,a4paper,final]{book}
\usepackage[utf8]{inputenc}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\usepackage{color}
\usepackage{pdfcolparallel}
\setkeys{parallel}{rulebetweencolor=blue}
\usepackage{hyperref} % for bookmark

\hypersetup{
%    bookmarks=true,         % show bookmarks bar?
    unicode=false,          % non-Latin characters in Acrobat’s bookmarks
    pdftoolbar=true,        % show Acrobat’s toolbar?
    pdfmenubar=true,        % show Acrobat’s menu?
    pdffitwindow=false,     % window fit to page when opened
    pdfstartview={FitH},    % fits the width of the page to the window
    pdftitle={My title},    % title
    pdfauthor={Author},     % author
    pdfsubject={Subject},   % subject of the document
    pdfcreator={Creator},   % creator of the document
    pdfproducer={Producer}, % producer of the document
    pdfkeywords={keyword1} {key2} {key3}, % list of keywords
    pdfnewwindow=true,      % links in new window
    colorlinks=true,       % false: boxed links; true: colored links
    linkcolor=blue,          % color of internal links (change box color with linkbordercolor)
    citecolor=green,        % color of links to bibliography
    filecolor=magenta,      % color of file links
    urlcolor=cyan           % color of external links
}

\begin{document}

\pagenumbering{roman}
\cleardoublepage
\pdfbookmark{\contentsname}{Contents}
\tableofcontents

\chapter{Fundamental differences}\hfill
\section{Bonds vs stocks}
\begin{Parallel}[v]{0.45\textwidth}{0.45\textwidth}
\ParallelLText{
    \textcolor{red}{Bonds}
    \begin{enumerate}
        \item Not a share of ownership
        \item Fixed maturity
        \item Contractual payment
        \item Bondholders acquire decision rights in default states.
    \end{enumerate}
}
\ParallelRText{
    \textcolor{red}{Stocks}
    \begin{enumerate}
        \item Share of ownership.
        \item Not maturity.
        \item No contractual payment.
        \item Stockholders have decision rights as long as the firm is solvent.
    \end{enumerate}
    }
\ParallelPar
\end{Parallel}


\end{document}

and here is result: enter image description here If use only package "pdfcolparallel", the result is very well. But I want to use more packages "hyperref" to creat bookmark. Would you help me fix this problem? Thks

share|improve this question
    
I don't understand what you are trying to achieve. Could you explain a little more or give an example image from another document? –  Stephan Lehmke Dec 19 '12 at 7:27
    
@StephanLehmke I believe he wants the items to appear under the two columns as the code would suggest, but instead they appear only once and justified left. –  Vivi Dec 19 '12 at 7:37
1  
@phuong I completed your code so that it could be compiled. This involves including everything from \documentclass{} until \end{document}, and it needs to have all packages necessary for the code to run. Please make sure you do that because it means the person helping you can concentrate on the problem instead of trying to guess what packages are missing. –  Vivi Dec 19 '12 at 7:38
    
Thks Vivi, because my network have some problem, i can't preview and fix code complete. Sorry about that –  phuong Dec 19 '12 at 10:18
    
@phuong It is not a problem... It was just a comment so you know what to do next time, but you haven't been on the site for long and no one would expect you to know that. The fact that you included some code is already a great thing! Also, if you want the person to get notified about your comment, you should include an @ before their name, unless you are commenting on their question or answer. Since the question is yours, I was not notified of your comment. –  Vivi Dec 19 '12 at 10:24
add comment

3 Answers

up vote 14 down vote accepted

It is a bug in package parallel. \linewidth is not set correctly. Environment enumerate thinks, it could use the full \textwidth and as result the left and right parts overprint each other:

\documentclass{article}
\usepackage{color}
\usepackage{parallel}
\begin{document}

\begin{Parallel}{0.45\textwidth}{0.45\textwidth}
\ParallelLText{
    \textcolor{red}{Bonds}
    \begin{enumerate}
        \item Not a share of ownership
        \item Fixed maturity
        \item \qquad Left text
        \item lll
    \end{enumerate}
}
\ParallelRText{
    \textcolor{red}{Stocks}
    \begin{enumerate}
        \item Not a share of ownership
        \item Fixed maturity
        \item rrr
        \item \qquad Right text
    \end{enumerate}
    }
\ParallelPar
\end{Parallel}

\end{document}

Overprint

Solution

Package pdfcolparallel fixes this bug by setting \linewidth to the correct value. If pdfTeX in PDF mode is used, it also adds support for pdfTeX's multiple color stacks for fixing color problems.

\documentclass{article}
\usepackage{color}
\usepackage{pdfcolparallel}
\begin{document}

\begin{Parallel}{0.45\textwidth}{0.45\textwidth}
\ParallelLText{
    \textcolor{red}{Bonds}
    \begin{enumerate}
        \item Not a share of ownership
        \item Fixed maturity
        \item \qquad Left text
        \item lll
    \end{enumerate}
}
\ParallelRText{
    \textcolor{red}{Stocks}
    \begin{enumerate}
        \item Not a share of ownership
        \item Fixed maturity
        \item rrr
        \item \qquad Right text
    \end{enumerate}
    }
\ParallelPar
\end{Parallel}

\end{document}

Result

With vertical line

Also the color of the vertical line can be changed with package pdfcolparallel:

\documentclass{article}
\usepackage{color}
\usepackage{pdfcolparallel}
\setkeys{parallel}{rulebetweencolor=blue}
\begin{document}

\begin{Parallel}[v]{0.45\textwidth}{0.45\textwidth}
\ParallelLText{
    \textcolor{red}{Bonds}
    \begin{enumerate}
        \item Not a share of ownership
        \item Fixed maturity
        \item \qquad Left text
        \item lll
    \end{enumerate}
}
\ParallelRText{
    \textcolor{red}{Stocks}
    \begin{enumerate}
        \item Not a share of ownership
        \item Fixed maturity
        \item rrr
        \item \qquad Right text
    \end{enumerate}
    }
\ParallelPar
\end{Parallel}

\end{document}

With vertical line

With package hyperref

Package hyperref needs to add specials to support links and anchors. However these "specials" disrupt the method of package parallel. In this case, the anchors for the items of environment enumerate are probably not needed, thus they can be disabled by environment NoHyper:

\documentclass[12pt,a4paper,final]{book}
\usepackage[utf8]{inputenc}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\usepackage{color}
\usepackage{pdfcolparallel}
\setkeys{parallel}{rulebetweencolor=blue}
\usepackage{hyperref} % for bookmark
\usepackage{bookmark}

\hypersetup{
    unicode,                % non-Latin characters in Acrobat's bookmarks
    pdftoolbar=true,        % show Acrobat's toolbar?
    pdfmenubar=true,        % show Acrobat's menu?   
    pdffitwindow=false,     % window fit to page when opened
    pdfstartview={FitH},    % fits the width of the page to the window
    pdftitle={My title},    % title
    pdfauthor={Author},     % author
    pdfsubject={Subject},   % subject of the document
    pdfcreator={Creator},   % creator of the document
    pdfproducer={Producer}, % producer of the document
    pdfkeywords={keyword1} {key2} {key3}, % list of keywords
    pdfnewwindow=true,      % links in new window
    colorlinks=true,       % false: boxed links; true: colored links
    linkcolor=blue,          % color of internal links (change box color with linkbordercolor)
    citecolor=green,        % color of links to bibliography
    filecolor=magenta,      % color of file links
    urlcolor=cyan           % color of external links
}

\begin{document}

\pagenumbering{roman}
\cleardoublepage
\pdfbookmark{\contentsname}{Contents}
\tableofcontents

\chapter{Fundamental differences}\hfill
\section{Bonds vs stocks}
\begin{Parallel}[v]{0.45\textwidth}{0.45\textwidth}
\ParallelLText{
    \textcolor{red}{Bonds}%
    \begin{NoHyper}%
    \begin{enumerate}
        \item Not a share of ownership
        \item Fixed maturity
        \item Contractual payment
        \item Bondholders acquire decision rights in default states.
    \end{enumerate}%
    \end{NoHyper}%  
}
\ParallelRText{
    \textcolor{red}{Stocks}%
    \begin{NoHyper}%
    \begin{enumerate}
        \item Share of ownership.
        \item Not maturity.
        \item No contractual payment.
        \item Stockholders have decision rights as long as the firm is solvent.
    \end{enumerate}%
    \end{NoHyper}%
    }
\ParallelPar
\end{Parallel}

\end{document}
share|improve this answer
    
Follow your solution'code, if i have a problem when i add vertical line: \begin{Parallel}[v]{0.45\textwidth}{0.45\textwidth} –  phuong Dec 19 '12 at 10:12
    
I have found the error I can't do same you.I have more package \usepackage[bookmarks=true]{hyperref} \usepackage{bookmark} But I don't know how to fix problem –  phuong Dec 19 '12 at 18:28
    
@phuong Minimal working example? Error message? –  Heiko Oberdiek Dec 19 '12 at 18:35
    
I have edited my post. See and help me fix it. Thks –  phuong Dec 20 '12 at 13:35
    
ok. It's worked. But it's so complicated. Can you have other simple question. Thanks for your help. –  phuong Dec 21 '12 at 7:03
add comment

And here is a solution using the multicol package, to get a rule between the columns. If the number of lines is different for each column, additional vertical space should be inserted on the column with the shortest text.

result

Here is the code

\documentclass{article}
\usepackage{xcolor}   % instead of color (more versatile color definitions)
\usepackage{parallel}
\usepackage{multicol}
\usepackage{lipsum}

\setlength{\columnseprule}{0.8pt} % width of the inter column rule 
\definecolor{crc}{rgb}{0,0,1}     % color of the inter column rule
\def\columnseprulecolor{\color{crc!50}}

\begin{document}

\lipsum[4]

\begin{multicols}{2}

\textcolor{red}{Bonds}
\begin{enumerate}
    \item Not a share of ownership
    \item Fixed maturity
\end{enumerate}

\textcolor{red}{Stocks}
\begin{enumerate}
    \item Not a share of ownership
    \item Fixed maturity
\end{enumerate}

\end{multicols}

\lipsum2]

\end{document}
share|improve this answer
add comment

You can use minipage:

\documentclass{article}
\usepackage{color}

\begin{document}

\begin{minipage}{0.45\textwidth}
    \textcolor{red}{Bonds}
    \begin{enumerate}
        \item Not a share of ownership
        \item Fixed maturity
    \end{enumerate}
\end{minipage}
\vrule \hspace{1cm} %this is what draws the line between the minipages
\begin{minipage}{0.45\textwidth}
    \textcolor{red}{Stocks}
    \begin{enumerate}
        \item Not a share of ownership
        \item Fixed maturity
    \end{enumerate}
\end{minipage}


\end{document}

which produces

enter image description here

share|improve this answer
    
with minipage, how can you create a vertical line between two columns –  phuong Dec 19 '12 at 10:15
    
@phuong you can include \vrule \hspace{1cm} between the minipages. I will modify the solution and the figure. –  Vivi Dec 19 '12 at 10:20
    
I think it's not good because it requires two paragraphs have the same length and you must input exactly position of vertical line (\hspace{1cm} ) –  phuong Dec 20 '12 at 13:38
    
@phuong The hspace{1cm} is a horizontal space to separate the line from the right-hand side column. The command the draws the line is \vrule. But yeah, other solutions provided here might work better for your case. –  Vivi Dec 20 '12 at 23:13
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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