顺便说一下,我花了大约五个小时在这里和互联网的其他地方不断寻找答案。
我对使用 LaTeX 还比较陌生,正在尝试创建带下划线的右对齐文本,但下划线跨越了整行。我花了几个小时来做这件事,这是我最接近的一次
为了演示我遇到的问题,我创建了这个示例:
%%%%%%%%%%Begin example%%%%%%%%%%
\usepackage{ulem}
%This creates a dashed underline
\dashuline{This is a test}
%This right align our dashed underlined text
\raggedleft\dashuline{This is a test}
%This creates a dashed underline that spans the entire line
\dashuline{This is a test\hspace*{\fill}}
%This should create a dash underline that spans the entire line and right aligns our text,
%but the text ends up left aligned. Why is this?
\raggedleft\dashuline{This is a test\hspace*{\fill}}
%%%%%%%%%%%End example%%%%%%%%%%%%%%
据我所知,\hspace*{\fill}
这是与 相关的一些问题导致的,因为一切都运行正常,没有给整行加下划线。有没有办法解决这个问题,或者有其他可行的方法来实现这一点?
答案1
尝试这个:
\dashuline{\hfill This is a test}
一个完整示例:
\documentclass{article}
\usepackage{ulem}
\begin{document}
\noindent\dashuline{This is a test}
{\raggedleft\dashuline{This is a test}\par}
\noindent\dashuline{This is a test\hspace*{\fill}}
\noindent\dashuline{\hfill This is a test}
\end{document}
代替
{\raggedleft\dashuline{This is a test}\par}
只需一行,使用
\hfill\dashuline{This is a test}
更好。