![问题](https://linux22.com/image/288084/%E9%97%AE%E9%A2%98.png)
我想Some text
与Lead Programmer
此对齐:
但是描述环境中的leftrulebox
(a tcolorbox
) 对齐不正确。以下代码给出了此信息:
代码:
\documentclass{article}
\usepackage[left=60pt,top=60pt,right=60pt,bottom=60pt]{geometry}
\usepackage{kantlipsum}
\usepackage{xcolor}
\usepackage{enumitem}
\setitemize{nolistsep,labelsep=1ex,leftmargin=*}
%% colors---
\definecolor{lightgray}{gray}{0.8}
%%items--
\newlist{items}{description}{1}
\setlist[items]{align=right,font=\normalfont, leftmargin=1.8in,style=nextline,labelsep=1em,}
%% leftrulebox---
\usepackage[many]{tcolorbox}
\tcbuselibrary{skins,breakable}
\newtcolorbox{leftrulebox}{
colback=white,
left=0.5ex,
top=0pt,
arc=0pt,
outer arc=0pt,
leftrule=1pt,
rightrule=0pt,
toprule=0pt,
bottomrule=0pt,
breakable,
enhanced jigsaw
}
%
%
\begin{document}
\begin{items}
\item[Some text]%
\begin{leftrulebox}
\par
\textbf{Lead Programmer}, Social Networks Inc \par
Some text \par some text
\begin{itemize}
\item Reengineered multiple systems that fueled improvements to productivity, eficiency, uptime and accuracy for global business operations. Developed code, system design and test/QA plans for all solutions and often coordinated the national or international rollout.
\item Led, architected and participated in the design, testing and deployment of client/server, multi-tier applications, ActiveX and related components.
\item Developed new procedures for requirements gathering, needs analysis, testing, scripting and documentation to strengthen quality and functionality of business-critical applications.
\end{itemize}
\kant[1-5]
\end{leftrulebox}
\end{items}
\end{document}
问题
- 是什么原因造成这种向下转变
Some text
? - 如何
Some text
与Lead Programmer...
警告
- 我不能使用任何形式的
tabular
(包括longtable
),因为我需要在分页符处继续规则。longtable
也不会在行内跨页中断。
编辑:
正如 Gonzalo 所指出的,对于框中相同类型的内容,使用\leavevmode
和一些负面vskip
效果很好。但对于下面的代码,我必须vskip
为不同的框提供不同的 s:
\documentclass{article}
\usepackage[left=60pt,top=60pt,right=60pt,bottom=60pt]{geometry}
\usepackage{xcolor}
\usepackage{enumitem}
\setitemize{nolistsep,labelsep=1ex,leftmargin=*}
%% colors---
\definecolor{lightgray}{gray}{0.8}
%%items--
\newlist{items}{description}{1}
\setlist[items]{align=right,font=\normalfont, leftmargin=1.8in,style=nextline,labelsep=1em,}
%% leftrulebox---
\usepackage[many]{tcolorbox}
\tcbuselibrary{skins,breakable}
\newtcolorbox{leftrulebox}{
colback=white,
left=0.5ex,
top=0pt,
arc=0pt,
outer arc=0pt,
leftrule=1pt,
rightrule=0pt,
toprule=0pt,
bottomrule=0pt,
breakable,
nobeforeafter,
enhanced jigsaw,
before=\vskip-16.5pt %% I want to define this here globally
}
%
%
\begin{document}
\section*{Objective}
\begin{items}
\item[Objective]%
\leavevmode
\begin{leftrulebox}
\kant[1]
\end{leftrulebox}
\end{items}
\section*{Positions}
\begin{items}
\item[\raggedleft 1/2010 -- 2/2012]%
\leavevmode
\begin{leftrulebox}
\textbf{Lead Programmer}, Social Networks Inc \par
Some text \par some text\par
\begin{itemize}%[labelsep=1ex]
\item Reengineered multiple systems that fueled improvements to productivity, eficiency, uptime and accuracy for global business operations. Developed code, system design and test/QA plans for all solutions and often coordinated the national or international rollout.
\item Led, architected and participated in the design, testing and deployment of client/server, multi-tier applications, ActiveX and related components.
\item Developed new procedures for requirements gathering, needs analysis, testing, scripting and documentation to strengthen quality and functionality of business-critical applications.
\end{itemize}
\end{leftrulebox}
\end{items}
\begin{items}
\item[1/2009 -- 2/2010]%
\leavevmode
\begin{leftrulebox}
\textbf{Programmer I}, The Coolest Search Engine \par
\begin{itemize}%[labelsep=1ex]
\item Led solutions engineering that involved process automation, macro conversion and functionality enhancement. Replaced time-consuming, error prone manual processes with elegant, automated solutions.
\item Developed and implemented cross-platform, Java-based POS system. Completed project under budget and three weeks ahead of deadline.
\item Coded new solutions that increased availability and scalability by 45\% and 75\%, respectively.
\end{itemize}
\end{leftrulebox}
\end{items}
\section*{Skills}
\begin{items}
\item[\textbf{Systems}]%
\leavevmode
\begin{leftrulebox}
\kant[1-2]
\end{leftrulebox}
\end{items}
\begin{items}
\item[\textbf{Others}]%
\leavevmode
\begin{leftrulebox}
some short text here
\end{leftrulebox}
\end{items}
\begin{items}
\item[\textbf{Databases}]%
\leavevmode
\begin{leftrulebox}
some short text here
\end{leftrulebox}
\end{items}
\end{document}
项目的对齐方式客观的和职位 令人满意,同时系统,其他的和数据库不是。发生这种情况是因为我已经给了全球的 vskip
(我想给予)。
盒子垂直移动的量取决于内容(AAArgh)我无法定义一个全局的vskip
。
不幸的是,由于此脚本将以自动方式使用,我无法控制内容,因此我无法确定vskip
不同项目的数量。因此,我无法全局定义它。如何克服这个问题?
答案1
更新后的版本
在对问题进行编辑之后,我提出了一种不同的方法,不是使用列表来放置标签,而是减少的宽度tcolorbox
并使用可选参数(可以很容易地变成强制性的)和overlay
将标签放在固定垂直位置的键;因为标签放在一个固定宽度的节点内,所以align=right
它们允许换行和左边不规则的文本(可以根据您的需要随意更改长度):
\documentclass{article}
\usepackage[left=60pt,top=60pt,right=60pt,bottom=60pt]{geometry}
\usepackage{xcolor}
\usepackage{kantlipsum}
\usepackage{enumitem}
\usepackage[many]{tcolorbox}
\setitemize{nolistsep,labelsep=1ex,leftmargin=*}
%% colors---
\definecolor{lightgray}{gray}{0.8}
%%items--
\newlist{items}{description}{1}
\setlist[items]{align=right,font=\normalfont, leftmargin=1.8in,style=nextline,labelsep=1em,}
%% leftrulebox---
\tcbuselibrary{skins,breakable}
\newtcolorbox{leftrulebox}[1][]{
colback=white,
left=0.5ex,
top=0pt,
arc=0pt,
outer arc=0pt,
enlarge left by=1.8in,
enlarge right by=-\dimexpr1.8in+\parindent\relax,
right=\dimexpr1.8in+\parindent\relax,
leftrule=1pt,
rightrule=0pt,
toprule=0pt,
bottomrule=0pt,
breakable,
nobeforeafter,
enhanced jigsaw,
overlay={
\node[anchor=north east,inner ysep=0pt,align=right,text width=1.5in]
at ([yshift=-0.55ex]frame.north west) {\hfill#1};
},
before=\vskip2\itemsep\noindent
}
\begin{document}
\section*{Objective}
\begin{leftrulebox}[Objective]
\kant[1]
\end{leftrulebox}
\section*{Positions}
\begin{leftrulebox}[1/2010 -- 2/2012]
\textbf{Lead Programmer}, Social Networks Inc \par
Some text \par some text
\begin{itemize}
\item Reengineered multiple systems that fueled improvements to productivity, eficiency, uptime and accuracy for global business operations. Developed code, system design and test/QA plans for all solutions and often coordinated the national or international rollout.
\item Led, architected and participated in the design, testing and deployment of client/server, multi-tier applications, ActiveX and related components.
\item Developed new procedures for requirements gathering, needs analysis, testing, scripting and documentation to strengthen quality and functionality of business-critical applications.
\end{itemize}
\end{leftrulebox}
\begin{leftrulebox}[1/2009 -- 2/2010]
\textbf{Programmer I}, The Coolest Search Engine
\begin{itemize}
\item Led solutions engineering that involved process automation, macro conversion and functionality enhancement. Replaced time-consuming, error prone manual processes with elegant, automated solutions.
\item Developed and implemented cross-platform, Java-based POS system. Completed project under budget and three weeks ahead of deadline.
\item Coded new solutions that increased availability and scalability by 45\% and 75\%, respectively.
\end{itemize}
\end{leftrulebox}
\section*{Skills}
\begin{leftrulebox}[\textbf{Systems}]
\kant[1-2]
\end{leftrulebox}
\begin{leftrulebox}[\textbf{Others}]
some short text here
\end{leftrulebox}
\begin{leftrulebox}[\textbf{Databases}]
some short text here
\end{leftrulebox}
\end{document}
一些显示标签对齐的图像:
第一个版本
TeX 处于垂直模式后\item[some text]
会产生不良效果。添加\leavevmode
。
\documentclass{article}
\usepackage[left=60pt,top=60pt,right=60pt,bottom=60pt]{geometry}
\usepackage{kantlipsum}
\usepackage{xcolor}
\usepackage{enumitem}
\setitemize{nolistsep,labelsep=1ex,leftmargin=*}
%% colors---
\definecolor{lightgray}{gray}{0.8}
%%items--
\newlist{items}{description}{1}
\setlist[items]{align=right,font=\normalfont, leftmargin=1.8in,style=nextline,labelsep=1em,}
%% leftrulebox---
\usepackage[many]{tcolorbox}
\tcbuselibrary{skins,breakable}
\newtcolorbox{leftrulebox}{
colback=white,
left=0.5ex,
top=0pt,
arc=0pt,
outer arc=0pt,
leftrule=1pt,
rightrule=0pt,
toprule=0pt,
bottomrule=0pt,
breakable,
enhanced jigsaw,
before=\vskip-13.5pt
}
%
%
\begin{document}
\begin{items}
\item[Some text]%
\leavevmode
\begin{leftrulebox}
\par
\textbf{Lead Programmer}, Social Networks Inc \par
Some text \par some text
\begin{itemize}
\item Reengineered multiple systems that fueled improvements to productivity, eficiency, uptime and accuracy for global business operations. Developed code, system design and test/QA plans for all solutions and often coordinated the national or international rollout.
\item Led, architected and participated in the design, testing and deployment of client/server, multi-tier applications, ActiveX and related components.
\item Developed new procedures for requirements gathering, needs analysis, testing, scripting and documentation to strengthen quality and functionality of business-critical applications.
\end{itemize}
\kant[1-5]
\end{leftrulebox}
\end{items}
\end{document}
由于 之前的常规间距,仅使用\leavevmode
框会稍微向下tcolorbox
;您可以通过在全局(如我的示例)或本地使用方便的\vskip
来纠正此问题before
,通过添加可选参数来将选项传递给tcolorbox
:
\documentclass{article}
\usepackage[left=60pt,top=60pt,right=60pt,bottom=60pt]{geometry}
\usepackage{kantlipsum}
\usepackage{xcolor}
\usepackage{enumitem}
\setitemize{nolistsep,labelsep=1ex,leftmargin=*}
%% colors---
\definecolor{lightgray}{gray}{0.8}
%%items--
\newlist{items}{description}{1}
\setlist[items]{align=right,font=\normalfont, leftmargin=1.8in,style=nextline,labelsep=1em,}
%% leftrulebox---
\usepackage[many]{tcolorbox}
\tcbuselibrary{skins,breakable}
\newtcolorbox{leftrulebox}[1][]{
colback=white,
left=0.5ex,
top=0pt,
arc=0pt,
outer arc=0pt,
leftrule=1pt,
rightrule=0pt,
toprule=0pt,
bottomrule=0pt,
breakable,
enhanced jigsaw,
#1
}
%
%
\begin{document}
\begin{items}
\item[Some text]
\leavevmode
\begin{leftrulebox}[before=\vskip-13.5pt]
\par
\textbf{Lead Programmer}, Social Networks Inc \par
Some text \par some text
\begin{itemize}
\item Reengineered multiple systems that fueled improvements to productivity, eficiency, uptime and accuracy for global business operations. Developed code, system design and test/QA plans for all solutions and often coordinated the national or international rollout.
\item Led, architected and participated in the design, testing and deployment of client/server, multi-tier applications, ActiveX and related components.
\item Developed new procedures for requirements gathering, needs analysis, testing, scripting and documentation to strengthen quality and functionality of business-critical applications.
\end{itemize}
\kant[1-5]
\end{leftrulebox}
\end{items}
\end{document}
答案2
我想建议另一种可能性。它仍需要一些工作,但如果它有趣,请告诉我。
\tcolorboxes
具有upper
和lower
部分,它们可以并排放置。因此,不要尝试将一些外部文本与tcolorbox
文本对齐,而应将两者都放在内部。外部文本将是upper text
,内部文本将是lower text
,left hand
规则将放在segmentation rule
内部tcolorbox
。
我找不到如何自定义分割线,但我已经使用解决了overlays
。
仍需解决的主要问题是如何自动确定lefthand width
为左侧列留出足够的空间。我试过\widthof
但没有成功。
\documentclass{article}
\usepackage[left=60pt,top=60pt,right=60pt,bottom=60pt]{geometry}
\usepackage{kantlipsum}
\usepackage{xcolor}
\usepackage{enumitem}
\usepackage{calc}
\setitemize{nolistsep,labelsep=1ex,leftmargin=*}
%% colors---
\definecolor{lightgray}{gray}{0.8}
%%items--
\newlist{items}{description}{1}
\setlist[items]{align=right,font=\normalfont, leftmargin=1.8in,style=nextline,labelsep=1em,}
%% leftrulebox---
\usepackage[many]{tcolorbox}
\tcbuselibrary{skins,breakable}
\newtcolorbox{leftrulebox}{
colback=white,
left=0.5ex,
top=0pt,
arc=0pt,
outer arc=0pt,
leftrule=0pt,
rightrule=0pt,
toprule=0pt,
bottomrule=0pt,
breakable,
enhanced jigsaw,
sidebyside,sidebyside align=top,
lefthand width=2cm,
segmentation hidden,
overlay={\draw[red] (segmentation.north)--(segmentation.south);}
}
\begin{document}
\begin{leftrulebox}
Some text
\tcblower
\textbf{Lead Programmer}, Social Networks Inc \par
Some text \par some text
\begin{itemize}
\item Reengineered multiple systems that fueled improvements to productivity, eficiency, uptime and accuracy for global business operations. Developed code, system design and test/QA plans for all solutions and often coordinated the national or international rollout.
\item Led, architected and participated in the design, testing and deployment of client/server, multi-tier applications, ActiveX and related components.
\item Developed new procedures for requirements gathering, needs analysis, testing, scripting and documentation to strengthen quality and functionality of business-critical applications.
\end{itemize}
\kant[1]
\end{leftrulebox}
\end{document}