将全宽扩展到一个边距

将全宽扩展到一个边距

我正在写一份简历将节标题放在加宽的左边距中。我想使用fullwidth环境作为页面顶部的标题。正式地说,这将扩展进入左边距与节标题对齐。但是,我只能让标题延伸到右边距的三分之二左右:

观察到的结果与期望的结果

leftmargin=-1in我在包声明中添加了fullwidth以获得正确的左对齐,但即使没有它,标题也不会按照定义延伸到整个右边距。 为什么会这样?我该如何纠正?

\hline(我还收到有关“放错位置”的警告\noalign,这可能与此有关。)

\documentclass[10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[margin=0.75in, left=1.5in]{geometry}

% Section headers in margins
% https://tex.stackexchange.com/a/1315/10906
\usepackage{titlesec}
\titleformat{\section}[leftmargin]
{\sffamily}
{}{0pt}{}
\titlespacing{\section}
{4pc}{1.5ex plus .1ex minus .2ex}{2pc}

\setlength\parindent{0pt}
\usepackage[leftmargin=-1in]{fullwidth}


\begin{document}

\begin{fullwidth}
\textsf{\Huge{John Q Doe}} \hfill [email protected]
\hline
\end{fullwidth}

\section{Foo}
This is some brief free-form text about some stuff that I can do.  Did you know I do Thing~3 and Thing~4?  It's pretty cool; I know.

\section{Bar and Baz}
\ldots

\end{document}

答案1

使用adjustwidthchangepage而是。它允许您调整特定文本的边距宽度(左和/或右;进入/离开边距):

在此处输入图片描述

\documentclass{article}
\usepackage[margin=0.75in, left=1.5in]{geometry}

% Section headers in margins
% http://tex.stackexchange.com/a/1315/5764
\usepackage{titlesec}
\titleformat{\section}[leftmargin]
  {\sffamily}
  {}{0pt}{}
  \titlespacing{\section}
  {4pc}{1.5ex plus .1ex minus .2ex}{2pc}

\setlength\parindent{0pt}
\usepackage{changepage}

\begin{document}

\begin{adjustwidth}{-1in}{0pt}
  \textsf{\Huge John Q Doe} \hfill [email protected] \par
  \hrulefill
\end{adjustwidth}

\section{Foo}
This is some brief free-form text about some stuff that I can do.  Did you know I do Thing~3 and Thing~4?  It's pretty cool; I know.

\section{Bar and Baz}
\ldots

\end{document}

此外,\hline仅限于tabular类似范围。 最好使用类似 的内容\hrulefill

相关内容