我做了一个简单的标题命令:
\documentclass{article}
\RequirePackage{graphics}
\newcommand{\modtitle}[2]{%
\vspace*{-5\baselineskip}\noindent\hspace*{-.75in}%
\resizebox{\dimexpr1.25in+\linewidth}{!}{\textsc{#1}}\\%
\hspace*{.1in}{\large \textsc{ \ \hfill \hspace*{.625in} #2}}
\vspace{\baselineskip}\\
}
\begin{document}
\modtitle{This is the Title}{The Author}
\end{document}
但作者空间与右边距对齐,而不是0.625in
更靠右的位置。显然我的\hspace*{.625in}
命令被 吞没了\hfill
。我怎么才能把它推得更远一点呢?
答案1
使用堆栈。当前(默认)间隙为3pt
,但您可以使用\stackunder[8pt]{...}
或其他合适的尺寸进行更改。
我把顶线水平放置在原帖中的位置(未居中)。如果想让它居中,下面的后续编码将实现这一点。
\documentclass{article}
\RequirePackage{graphics,stackengine}
\def\mmodtitle#1#2{\def\stackalignment{r}%
\vspace*{-5\baselineskip}\noindent\hspace*{-.75in}%
\stackunder{%
\resizebox{\dimexpr1.25in+\linewidth}{!}{\textsc{#1}}%
}{%
{\large\textsc{#2}}%
}
\vspace{\baselineskip}\\
}
\begin{document}
\mmodtitle{This is the Title}{The Author}
\end{document}
请注意,如果您希望标题居中,可以这样修改宏:
\documentclass{article}
\RequirePackage{graphics,stackengine}
\def\modtitle#1#2{\def\stackalignment{r}%
\vspace*{-5\baselineskip}\noindent\makebox[\linewidth]{%
\stackunder{%
\resizebox{\dimexpr1.25in+\linewidth}{!}{\textsc{#1}}%
}{%
{\large\textsc{#2}}%
}}%
\vspace{\baselineskip}\\
}
\begin{document}
\modtitle{This is the Title}{The Author}
\noindent\hrulefill
\end{document}
答案2
\documentclass{article}
\usepackage{graphicx}
\newcommand{\modtitle}[2]{%
\begin{center}
\vspace*{-5\baselineskip}
\makebox[0pt][c]{%
\begin{tabular}{@{}r@{}}
\resizebox{\dimexpr1.25in+\linewidth}{!}{\textsc{#1}}\\
\large \textsc{#2}
\end{tabular}
}
\vspace{\baselineskip}
\end{center}
}
\begin{document}
\modtitle{This is the Title}{The Author}
\end{document}
答案3
这是一种方法。请注意,我已将标题(我认为)相对于正文居中,我认为这是您的意图。
\documentclass{article}
\usepackage{graphics,calc}
\newsavebox{\modtitlebox}
\newcommand{\modtitle}[2]{%
\sbox{\modtitlebox}{%
\begin{minipage}{\dimexpr1.25in+\textwidth}
\vspace*{-5\baselineskip}%
{\resizebox{\linewidth}{!}{\textsc{#1}}\par}
\hspace*{\fill}\large\textsc{#2}\vspace{\baselineskip}\par
\end{minipage}}%
\centering
\makebox[0pt]{\usebox{\modtitlebox}}}
\begin{document}
\modtitle{This is the Title}{The Author}
\end{document}
答案4
也许使用\rlap
会产生您想要的结果:
\documentclass{article}
\RequirePackage{graphics}
\newcommand{\modtitle}[2]{%
\vspace*{-5\baselineskip}\noindent\hspace*{-.75in}%
\resizebox{\dimexpr1.25in+\linewidth}{!}{\textsc{#1}}\\%
\hspace*{.1in}{\large \textsc{ \ \hfill \rlap{\hspace*{.625in} #2}}}
\vspace{\baselineskip}\\
}
\begin{document}
\modtitle{This is the Title}{The Author}
\end{document}