使用并行包时不显示枚举列表

使用并行包时不显示枚举列表

我想用枚举来划分一个段落。首先我使用包“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}

因此这两项不会出现在两列之下。它们只是出现在左侧。

在此处输入图片描述

我不知道如何修复它。而且,对于该包paracol,我不知道如何在列之间创建垂直线。

谁能帮我?

如果您知道比这些包更好的包,请告诉我。


@Heiko Oberdiek:当我使用 hyperref 和 pdfcolparallel 这两个包时,我仍然遇到垂直问题。这是我的代码:

\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}

结果如下: 在此处输入图片描述 如果只使用包“pdfcolparallel”,结果非常好。但我想使用更多包“hyperref”来创建书签。你能帮我解决这个问题吗?谢谢

答案1

这是包中的一个错误parallel\linewidth设置不正确。环境enumerate认为,它可以使用全部\textwidth,结果左右部分相互重叠:

\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}

叠印

解决方案

软件包pdfcolparallel通过设置为正确的值来修复此错误\linewidth。如果使用 PDF 模式下的 pdfTeX,它还会添加对 pdfTeX 的多种颜色堆栈的支持,以修复颜色问题。

\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}

结果

有垂直线

还可以使用包来更改垂直线的颜色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}

有垂直线

带包装hyperref

hyperref需要添加特殊项来支持链接和锚点。然而这些“特殊项”会破坏包的方法parallel。在这种情况下,环境项的锚点enumerate可能不需要,因此可以通过环境禁用它们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}

答案2

这里有一个使用multicol包的解决方案,用于在列之间设置规则。如果每列的行数不同,则应在文本最短的列上插入额外的垂直空间。

结果

以下是代码

\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}

答案3

您可以使用小页面:

\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}

产生

在此处输入图片描述

相关内容