我创建了一个问卷(问答)。为此,我使用了 pdfcolparallel 包。当我\subsubsection
在第一列中输入内容时,在 subsubsection 和顶部边框之前会出现一条奇怪的垂直线。我认为这与使用 subsubsection 有关,因为没有它一切都正常。itemize
环境也出现了同样的问题。您能向我解释一下这种情况发生的原因吗?是否有任何现有的解决方法?
\documentclass{article}
\usepackage[left=2cm, top=1.5cm, right=1.2cm, bottom=2cm, includehead]{geometry}
\usepackage[pdftex]{graphicx}
\usepackage[svgnames]{xcolor}
\usepackage{helvet}
\usepackage{fancyhdr}
\usepackage{eso-pic}
\usepackage[titletoc,title]{appendix}
\usepackage[tiny]{titlesec}
\usepackage{enumitem}
\usepackage{cals}
\usepackage[lastpage,user]{zref}
\usepackage{tocloft}
\usepackage[hidelinks]{hyperref}
%\usepackage{parallel}
\usepackage{framed}
\usepackage{pdfcolparallel}
\setkeys{parallel}{rulebetweencolor=black}
%%%%%%%%%%% layout
\voffset = 0pt
\hoffset = 0pt
\headheight = 35pt
\headsep = 0.4cm
\footskip = 0.7cm
\oddsidemargin = -14pt
\topskip=0.7cm
\setlength{\parindent}{0pt}
\hyphenpenalty 10000
%%%%%%%%%%% Header-Footer style
\makeatletter
\renewcommand{\numberline}[1]{%
\@cftbsnum #1\@cftasnum~\@cftasnumb%
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\definecolor{MySpecHeaderColor}{RGB}{219,132,0}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\makeatletter
\let\stdl@section\l@section
\renewcommand*{\l@section}[2]{%
\stdl@section{\textcolor{black}{#1}}{\textcolor{black}{#2}}}
% itemize enviroment
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%section/subsection/subsubsection numbering
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\titleformat{\section}
{\normalfont\fontsize{15}{20}\bfseries}{\thesection}{1em}{}
\renewcommand\thesection{\arabic{section}}
\renewcommand\thesubsection{\thesection.\arabic{subsection}\normalfont}
\renewcommand\thesubsubsection{\thesubsection.\arabic{subsubsection}\normalfont}
\titlespacing*{\subsubsection}{0pt}{-7.5pt}{-16pt}
\titleformat*{\subsubsection}{\normalfont}
\titleformat*{\section}{\Large\bfseries\sffamily\color{MySpecHeaderColor}}
\titleformat*{\subsection}{\large\bfseries\sffamily\color{black}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Text}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{framed}
\begin{Parallel}[v]{6cm}{10cm}
\ParallelLText{\subsubsection{rague Experience is your complete Prague tourist information and travel guide.
We are the original online Prague city guide and booking service, and over the past 11 years we have built a lot of useful visitor information into this website.
}}
\ParallelRText{
You can browse through our exclusive deals on Prague hotels and apartments, arrange airport transfers, and book tickets for the best Prague sightseeing trips and entertainment.
We feature a range of Prague tours, including sightseeing tours by coach, walking tours and leisurely Prague river cruises. And we provide listings for the Prague opera, ballet and classical concerts, plus black light and marionette theatre.
Read our guide to Prague restaurants for all budgets, and discover our great package deals on Prague city breaks, Prague stag weekends and Prague hen nights.
Booking is easy, with information fully encrypted on our secure servers.
You can browse through our exclusive deals on Prague hotels and apartments, arrange airport transfers, and book tickets for the best Prague sightseeing trips and entertainment.
We feature a range of Prague tours, including sightseeing tours by coach, walking tours and leisurely Prague river cruises. And we provide listings for the Prague opera, ballet and classical concerts, plus black light and marionette theatre.
Read our guide to Prague restaurants for all budgets, and discover our great package deals on Prague city breaks, Prague stag weekends and Prague hen nights.
Booking is easy, with information fully encrypted on our secure servers.
}
\ParallelPar
\hrule
\ParallelLText{\subsubsection{rague Experience is your complete Prague tourist information and travel guide.
We are the original online Prague city guide and booking service, and over the past 11 years we have built a lot of useful visitor information into this website.
}}
\ParallelRText{
You can browse through our exclusive deals on Prague hotels and apartments, arrange airport transfers, and book tickets for the best Prague sightseeing trips and entertainment.
We feature a range of Prague tours, including sightseeing tours by coach, walking tours and leisurely Prague river cruises. And we provide listings for the Prague opera, ballet and classical concerts, plus black light and marionette theatre.
Read our guide to Prague restaurants for all budgets, and discover our great package deals on Prague city breaks, Prague stag weekends and Prague hen nights.
Booking is easy, with information fully encrypted on our secure servers.
You can browse through our exclusive deals on Prague hotels and apartments, arrange airport transfers, and book tickets for the best Prague sightseeing trips and entertainment.
We feature a range of Prague tours, including sightseeing tours by coach, walking tours and leisurely Prague river cruises. And we provide listings for the Prague opera, ballet and classical concerts, plus black light and marionette theatre.
Read our guide to Prague restaurants for all budgets, and discover our great package deals on Prague city breaks, Prague stag weekends and Prague hen nights.
Booking is easy, with information fully encrypted on our secure servers.
\\
\\
}
\ParallelPar
\end{Parallel}
\end {framed}
\end{document}
答案1
包中parallel
考虑了可以分成单行的简单文本,但\subsubsection
相当复杂。有颜色的 whatsits 和hyperref
进入垂直列表的锚点的 whatsits。然后parallel
拆分列表以获取一行并获取没有宽度的 whatsits,因此垂直线向左移动。
解决方法\parbox
下面的示例在一个更小的文件中展示了该问题并将其\subsubsection
放入\parbox
:
\documentclass{article}
\usepackage[hmargin=2cm]{geometry}
\usepackage{parallel}
\usepackage{pdfcolparallel}
\setlength{\parindent}{0pt}
\usepackage{lipsum}
\begin{document}
\begin{Parallel}[v]{6cm}{10cm}
\hrule
\ParallelLText{%
\subsubsection{Experience complete with Prague tourist information}%
}
\ParallelRText{\lipsum[1]}
\ParallelPar
\hrule
\ParallelLText{%
\vspace*{-1.5ex}%
\noindent
\parbox[b]{6cm}{%
\subsubsection{Experience complete with Prague tourist information}%
}%
}
\ParallelRText{\lipsum[1]}
\ParallelPar
\hrule
\end{Parallel}
\end{document}
例如,通过删除\vspace*{-1ex}
一些额外的空间。\subsubsection
\parbox
不可破坏,因此右侧部分没有填充文本行。
解决方法parallel
包parallel
将从垂直列表中分割出的行放入 中\vbox
,并假设行宽将设置为 的宽度\vbox
。由于假设并不适用于所有情况,因此以下补丁将\hbox
正确宽度的 放在 周围\vbox
。示例重新定义\ParallelParOnePage
了包pdfcolparallel
,但问题已经从包 继承parallel
:
\documentclass{article}
\usepackage[hmargin=2cm]{geometry}
\usepackage{parallel}
\usepackage{pdfcolparallel}
\setlength{\parindent}{0pt}
\usepackage{lipsum}
\makeatletter
\renewcommand*{\ParallelParOnePage}{%
\ifnum\ParallelBoolVar=\@ne
\par
\begingroup
\leftmargin=\z@
\rightmargin=\z@
\parskip=\z@skip
\parindent=\z@
\vbadness=10000 %
\vfuzz=3ex %
\splittopskip=\z@skip
\loop
\ifnum\ParallelBoolVar=\@ne
\noindent
\hbox to\textwidth{%
\hskip\ParallelLeftMargin
\hbox to\ParallelTextWidth{%
\ifvoid\ParallelLBox
\hskip\ParallelLWidth
\else
\pcp@SetCurrent{Left}%
\ParallelWhichBox=\z@
\hbox to \ParallelLWidth{%
\vbox{%
\setbox\ParallelBoxVar
=\vsplit\ParallelLBox to\dp\strutbox
\unvbox\ParallelBoxVar
}%
\hss
}%
\fi
\strut
\ifnum\ParallelBoolMid=\@ne
\hskip\ParallelMainMidSkip
\begingroup
\pcp@RuleBetweenColor
\vrule
\endgroup
\else
\hss
\fi
\hss
\ifvoid\ParallelRBox
\hskip\ParallelRWidth
\else
\pcp@SetCurrent{Right}%
\ParallelWhichBox=\@ne
\vbox{%
\setbox\ParallelBoxVar
=\vsplit\ParallelRBox to\dp\strutbox
\unvbox\ParallelBoxVar
}%
\fi
}%
}%
\ifvoid\ParallelLBox
\ifvoid\ParallelRBox
\global\ParallelBoolVar=\z@
\fi
\fi%
\fi%
\ifnum\ParallelBoolVar=\@ne
\penalty\interlinepenalty
\repeat
\par
\endgroup
\pcp@SetCurrent{}%
\fi
}
\makeatother
\begin{document}
\begin{Parallel}[v]{6cm}{10cm}
\hrule
\ParallelLText{%
\subsubsection{Experience complete with Prague tourist information}%
}
\ParallelRText{\lipsum[1]}
\ParallelPar
\hrule
\end{Parallel}
\end{document}
现在垂直线在中间正确移动,但有一个间隙和东西,这\subsubsection
让前它的实际标题导致了另一个问题。包parallel
现在可以在子小节标题前拆分出一个可视空行(什么,垂直空间),并且此空行与右侧的文本行匹配。
使用模拟的解决方法\subsubsection
更好的方法可能是手动将章节标题作为文本,正如 Andrew Swann 在其评论对这个问题。
以下示例\parallelsubsubsection
使用与星号形式和可选参数相同的语法进行定义\subsubsection
。它还处理了悬挂缩进:
\documentclass{article}
\usepackage[hmargin=2cm]{geometry}
\usepackage{parallel}
\usepackage{pdfcolparallel}
\setlength{\parindent}{0pt}
\usepackage{lipsum}
\makeatletter
\newcommand*{\parallelsubsubsection}{%
\@ifstar\parallelsubsubsection@star
\parallelsubsubsection@
}
\newcommand*{\parallelsubsubsection@star}[1]{%
\noindent
\textbf{#1}%
\par
}
\newcommand*{\parallelsubsubsection@}{%
\@dblarg\parallelsubsubsection@@
}
\def\parallelsubsubsection@@[#1]#2{%
\refstepcounter{subsubsection}%
\noindent
\begingroup
\bfseries
\addcontentsline{toc}{subsubsection}{#1}%
\sbox0{\thesubsubsection\enskip}%
\hangafter=1\relax
\setlength{\hangindent}{\wd0}%
\thesubsubsection\enskip#2\par
\endgroup
}
\makeatother
\begin{document}
\begin{Parallel}[v]{6cm}{10cm}
\hrule
\ParallelLText{%
\parallelsubsubsection{%
Experience complete with Prague tourist information%
}%
}
\ParallelRText{\lipsum[1]}
\ParallelPar
\hrule
\end{Parallel}
\end{document}