latex - 并行 Latex 环境中的 Jutification
问题描述
下面的代码有效,但有两个问题:
理由不起作用,因此每一列都渗入空白区域并且不完全合理。
我想要一条分隔两列的垂直线:在左列的右边缘。
而且这些段落似乎没有缩进,或者它们之间没有空格。
想法?
\tolerance 代码通常用于解决对齐问题,但它不在这里。而且, \colseprulecolor{CustomGrey} 通常适用于一行,但不在这里。
\documentclass[12pt]{article}
\usepackage[letterpaper, % Choose paper size
left= 1.0in, % Set the margins
right= 1.0in, %
top= 1.0in, %
bottom=1.5in]{geometry} %
\usepackage{paracol,lipsum} % Needed for the column environment
\usepackage[english]{babel}
\usepackage[utf8]{inputenc} % Apostrophes and quotes need this
\usepackage{fancyhdr} % Needed for header and footer lines and colors
\usepackage{enumitem}
\usepackage{graphicx}
\usepackage{pythontex} % Allows for the inclusion of Python code
\usepackage{lastpage} % Needed for page numbering
\usepackage[dvipsnames]{xcolor} % Needed for the colors in the commands
\usepackage[font={scriptsize}]{caption}
\usepackage[retainorgcmds]{IEEEtrantools}
\usepackage{parallel}
%---------------------------- Colors ----------------------------------------------------------------------------%
\definecolor{CustomOrange}{rgb}{1, 0.43529, 0.01176} % Define custom colors
\definecolor{CustomGrey}{rgb}{0.4745, 0.4745, 0.4745} % Define custom colors
%---------------------------- Header & Footer -------------------------------------------------------------------%
\pagestyle{fancy}
\fancyhf{}
\renewcommand{\headrulewidth}{1.0pt} % Thickness of header rule
\renewcommand{\headrule}{\hbox to\headwidth{\color{CustomOrange}\leaders\hrule height \headrulewidth\hfill}}
\renewcommand{\footrulewidth}{1pt} % Thickness of header rule
\renewcommand{\footrule}{\hbox to\headwidth{\color{CustomOrange}\leaders\hrule height \headrulewidth\hfill}}
\fancyfoot[R]{Page \thepage\ of \pageref{LastPage}} % Page numbering
\setlength{\parindent}{0pt} % Indentation of paragraphs
\setlength{\parskip}{0.35cm plus0mm minus0mm} % Used to set space between paragraphs. Requires {parskip}
\setlength\headheight{60pt}
%---------------------------- Set Columns -----------------------------------------------------------------------%
%\columnsep=0.05\textwidth % Set space between columns
%\setcolumnwidth{.35\textwidth, .6\textwidth} % One entry for each column, see paracol{} below
\tolerance=1 % Code fixes the justification issue with columns flowing over
\emergencystretch=\maxdimen %
\hyphenpenalty=10000 %
\hbadness=10000 %
\setlength{\columnseprule}{1.0pt} % Thickness and color of vertical line between columns
\colseprulecolor{CustomGrey} %
%---------------------------- Begin Document---------------------------------------------------------------------%
\begin{document}
\begin{Parallel}{2in}{4in}
\ParallelLText{\lipsum[1-7]}
\ParallelRText{\lipsum[2-6]}
\end{Parallel}
\end{document}
解决方案
问题 1可以使用\sloppy
关键字来解决。它用于处理宽度较小的列/框以止血。
\begin{Parallel}{2in}{4in}
当您更改为时,问题 2将消除\begin{Parallel}[v]{2in}{4in}
。[v]
表示列之间的垂直线。
问题 3的出现是因为\setlength{\parindent}{0pt}
您在序言中指定的行。这将重置整个文档中的缩进。
把所有东西放在一起:
%Remove the follwing line: \setlength{\parindent}{0pt}
\begin{Parallel}[v]{2in}{4in}
\sloppy
\ParallelLText{\lipsum[1-7]}
\ParallelRText{\lipsum[2-6]}
\end{Parallel}
现在这些应该可以解决您的问题。
编辑!
这是另一个使用的解决方案paracol
:
\documentclass[12pt]{article}
\usepackage[letterpaper, % Choose paper size
left= 1.0in, % Set the margins
right= 1.0in,
top= 1.0in,
bottom=1.5in]{geometry}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc} % Apostrophes and quotes need this
\usepackage{fancyhdr} % Needed for header and footer lines and colors
\usepackage{enumitem}
\usepackage{graphicx}
\usepackage{pythontex} % Allows for the inclusion of Python code
\usepackage{lastpage} % Needed for page numbering
\usepackage[dvipsnames]{xcolor} % Needed for the colors in the commands
\usepackage[font={scriptsize}]{caption}
\usepackage[retainorgcmds]{IEEEtrantools}
\usepackage{lipsum} % Random text
%---------------------------- New Packages ----------------------------------------------------------------------%
\usepackage{paracol} % Used for creating independent columns as well as page layout
\usepackage{float} % Allows to insert table/figure in the exact position by using the H parameter
\usepackage[none]{hyphenat} % No hyphenation
\usepackage{wrapfig} % Allows to wrap table/figure to span both left and right column
\definecolor{CustomOrange}{rgb}{1, 0.43529, 0.01176} % Define custom colors
\definecolor{CustomGrey}{rgb}{0.4745, 0.4745, 0.4745} % Define custom colors
%---------------------------- Header & Footer -------------------------------------------------------------------%
\pagestyle{fancy}
\fancyhf{}
\renewcommand{\headrulewidth}{1.0pt} % Thickness of header rule
\renewcommand{\headrule}{\hbox to\headwidth{\color{CustomOrange}\leaders\hrule height \headrulewidth\hfill}}
\renewcommand{\footrulewidth}{1pt} % Thickness of footer rule
\renewcommand{\footrule}{\hbox to\headwidth{\color{CustomOrange}\leaders\hrule height \headrulewidth\hfill}}
\fancyfoot[R]{Page \thepage\ of \pageref{LastPage}} % Page numbering
\setlength\headheight{60pt}
%---------------------------- Paragraph Style -------------------------------------------------------------------%
\setlength\parindent{0pt}% no indentation
% The two lines below used to set the space between paragraphs to 0.35cm
\setlength\parskip{0.35cm}
\setlength\parsep{\parskip}
%---------------------------- Set Columns -----------------------------------------------------------------------%
\setcolumnwidth{0.35\textwidth,0.65\textwidth} % Size of columns (col 1 and col 2) respectively
\setlength{\columnseprule}{1.0pt} % Thickness and color of vertical line between columns
\colseprulecolor{CustomGrey} % Color of the vertical line between columns
\setlength{\columnsep}{3em} % Size of the space between columns.
%---------------------------- Color of Document -----------------------------------------------------------------%
\backgroundcolor{c[0]}[RGB]{255, 186, 186} % Color of left column (light red)
\backgroundcolor{c[1]}[RGB]{186, 186, 255} % Color of right column (light blue)
\backgroundcolor{g}{yellow} % Color of space between the columns
\backgroundcolor{t}{green} % Color of top margin
\backgroundcolor{b}{purple} % Color of bottom margin
\backgroundcolor{l}{brown} % Color of left margin
\backgroundcolor{r}{orange} % Color of right margin
\backgroundcolor{p}{black} % Color of the space remaining when the columns don't span the whole page (IMPORTANT!)
%---------------------------- Miscellaneous --------------------------------------------------------------------%
% Paracol uses its own numbering of tables/figures, \globalcounter* allows to
% Use the default numbering that latex uses. It is needed because it will mess
% the numbering in your document.
\globalcounter*
% \printpythontex % You might need this??
%---------------------------- Begin Document---------------------------------------------------------------------%
\begin{document}
\begin{paracol}{2}
% We start at left column (column[0])
\sloppy
\textbf{Beginning of paragraph 1 (placed on the left column).} \lipsum[1] \textbf{End of paragraph 1.}
\begin{figure}[H]
\includegraphics[width=\linewidth]{example-image-a}
\caption{First figure in document and is placed in the first column (first figure in column 1).}
\end{figure}
% End of left column
\switchcolumn[1]
% Start at the right column (column[1])
\textbf{Beginning of paragraph 2 (placed on the right column).} \lipsum[2] \textbf{End of paragraph 2.}
\begin{figure}[H]
\includegraphics[width=\linewidth]{example-image-b}
\caption{Second figure in document and is placed in the second column (first figure in column 2).}
\end{figure}
% End of right column
\switchcolumn[0]
% Switch back to left column (column[0])
\textbf{Beginning of paragraph 3 (placed on the left column).} \lipsum[3] \textbf{End of paragraph 3.}
\begin{figure}[H]
\includegraphics[width=\linewidth]{example-image-c}
\caption{Third figure in document and is placed in the first column (second figure in column 1).}
\end{figure}
% End of left column
\switchcolumn[1]
% Switch to right column (column[1])
\textbf{Beginning of paragraph 4 (placed on the right column).} \lipsum[4] \textbf{End of paragraph 4.}
\begin{figure}[H]
\includegraphics[width=\linewidth]{example-image-a}
\caption{Fourth figure in document and is placed in the second column (second figure in column 2).}
\end{figure}
\textbf{Beginning of paragraph 5 (placed on the right column).} \lipsum[5] \textbf{End of paragraph 5.}
\begin{table}[H]% Try here, and then top
\centering
\begin{tabular}{ |c|c|c|c|c|c| }
\hline
cell1 & cell2 & cell3 & cell4 & cell5 & cell6 \\
cell1 & cell2 & cell3 & cell4 & cell5 & cell6 \\
cell1 & cell2 & cell3 & cell4 & cell5 & cell6 \\
\hline
\end{tabular}
\caption{The one and only table in the document. It is placed in column 2.}
\end{table}
% End of right column
\end{paracol}
\end{document}
推荐阅读
- javascript - 未执行 while 循环内的代码 JavaScript
- angular - 路由的“出口”属性在 angular6+ 中不起作用
- android - Android Studio 关闭后无法打开
- ruby - caller_locations[...].path 是否总是包含 $PROGRAM_NAME?
- azure - Azure DevOps Pipeline Azure Blob 存储上传文件 403 禁止异常
- laravel - 无法在多对多上使用相同的代码进行更新,但在一对多上进行了更新。错误是 SQLSTATE[23000]:违反完整性约束:
- php - 我需要从数据库中检索数据并在 php if 语句中使用它
- azure - 如何以编程方式更新 Azure 资源特权身份管理角色
- javascript - 使用 ID 而不是 NAME 使用 php 验证单选按钮
- c - 如何手动编译共享 dpi lib?