vah*_*idg 16 latex alignment tabular
我有两个非常短的和连续的部分(对于CV),每个部分包含一个小表:
\section{Work Experience}
\begin{tabular}{r|p{11cm}}
Current & Your job at Your Company, Town \\
Jan 2009 & What your company does \\
& A description of what you do\\
\multicolumn{2}{c}{}\
\end{tabular}
\section{Education}
\begin{tabular}{r|p{11cm}}
Slightly wider first column & University, Town \\
Jan 2009 & Thesis subject \\
& A description of what you did\\
\multicolumn{2}{c}{}\
\end{tabular}
Run Code Online (Sandbox Code Playgroud)
因此每个表都有两列:第一列包含句点,右侧对齐.第二种:一些宽度更高的信息,顶部(和左侧)对齐.
该问题是这两个表中左栏的宽度是不同的,并不好看,因为部分(因此表)是连续在一个页面.我不能给r
宽度像p
:
\begin{tabular}{r{11cm}|p{11cm}}
Run Code Online (Sandbox Code Playgroud)
不行.如何使两个表的第一列的宽度相同,同时使它们右对齐?
编辑感谢您的答案,他们都为我工作,所以我赞成所有这些,并接受了最吸引我(最受欢迎)的那个,因为你不必\hfill
在每一行中指定.但是,如果您不想出于任何原因使用阵列包,那么其他解决方案也很棒.
Ram*_*nka 17
如果您使用该array
包,您可以\hfill
按如下方式放入标题中,这样您就不必记住\parbox
在每一行中放置它(或者一个).
\documentclass{article}
\usepackage{multicol}
\usepackage{array}
\begin{document}
\section{Work Experience}
\begin{tabular}{>{\hfill}p{5cm}|p{11cm}}
Current & Your job at Your Company, Town \\
Jan 2009 & What your company does \\
& A description of what you do\\
\multicolumn{2}{c}{}
\end{tabular}
\section{Education}
\begin{tabular}{>{\hfill}p{5cm}|p{11cm}}
Slightly wider first column & University, Town \\
Jan 2009 & Thesis subject \\
& A description of what you did\\
\multicolumn{2}{c}{}
\end{tabular}
\end{document}
Run Code Online (Sandbox Code Playgroud)
给:
alt text http://www.freeimagehosting.net/uploads/5e29f675e3.jpg
以下是使用该tabularx
软件包的@ RTBarnard答案的变体:
\documentclass[a4paper,twoside,draft,12pt]{article}
\usepackage{tabularx}
\begin{document}
\section{Work Experience}
\begin{tabularx}{\textwidth}{>{\raggedleft}X|p{8cm}}
Current & Your job at Your Company, Town \\
Jan 2009 & What your company does \\
& A description of what you do\\
\end{tabularx}
\section{Education}
\begin{tabularx}{\textwidth}{>{\raggedleft}X|p{8cm}}
Somewhat wider than first column,
overflowing into additional lines & University, Town \\
Jan 2009 & Thesis subject \\
& A description of what you did\\
\end{tabularx}
\end{document}
Run Code Online (Sandbox Code Playgroud)
笔记:
tabularx
?因为通常更容易知道整个表可用的宽度,并让TeX计算未知的列宽.\textwidth
填充类型块的宽度,但您可以将其更改为您需要的任何度量.\raggedright
而不是\hfill
:如果项目流到第二行,\hfill
则只会右对齐段落的第一行.\multicol
显著?我删除它以尽可能简单地回答.在TeXLive下使用XeTeX运行.
归档时间: |
|
查看次数: |
19506 次 |
最近记录: |