标题右侧有一张图片。对于标题,我使用下划线\titlerule
。
可以调整线条的长度吗?我希望线条只到文档的中间。
\documentclass[a4paper,10pt]{article}
\usepackage{titlesec}
\titleformat{\subsection}{\Large\scshape\raggedright}{}{0em}{}
[\titlerule]
\titlespacing{\subsection}{0pt}{3pt}{3pt}
\begin{document}
\pagestyle{empty} % non-numbered pages
\begin{wrapfigure}{r}{0.28\textwidth}
\begin{center}
\includegraphics[width=0.23\textwidth]{picture}
\end{center}
\end{wrapfigure}
\subsection{Personal Data}
\begin{tabular}{rl}
\textsc{Date of Birth:} & xxx\\
\textsc{Address:} & xxx\\
\textsc{Phone:} & xxx\\
\textsc{email:} & \href{mailto:xxx}{xxx}
\end{tabular}
\end{document}
答案1
\titlerule
下面的示例修改了用于\titlewidth
设置规则宽度的内部工作原理:
\documentclass{article}
\usepackage{titlesec}
\titleformat{\subsection}{\Large\scshape\raggedright}{}{0em}{}
[\titlerule]
\titlespacing{\subsection}{0pt}{3pt}{3pt}
\let\oldtitleline\titleline
\renewcommand{\titleline}{\oldtitleline*}
\begin{document}
\pagestyle{empty} % non-numbered pages
\setlength{\titlewidth}{0.5\textwidth}
\subsection{Personal Data}
\begin{tabular}{rl}
\textsc{Date of Birth:} & xxx \\
\textsc{Address:} & xxx \\
\textsc{Phone:} & xxx \\
\textsc{email:} & xxx
\end{tabular}
\setlength{\titlewidth}{\textwidth}
\subsection{Personal Data}
\begin{tabular}{rl}
\textsc{Date of Birth:} & xxx \\
\textsc{Address:} & xxx \\
\textsc{Phone:} & xxx \\
\textsc{email:} & xxx
\end{tabular}
\end{document}