我在这里寻找一个关于设置命令 \underline 长度的示例。我试图在一条长度固定为 10cm 的线的顶部生成文本,文本大小可变。此外,文本应该左对齐(而不是像这里的示例那样居中)。这是一个最小的例子。谢谢。
\documentclass[a4paper,brazil, 12pt]{report}
\usepackage{amsmath,amsfonts,amscd,bezier}
\usepackage{amssymb}
\usepackage{babel}
\usepackage[latin1]{inputenc}
\usepackage[shortlabels]{enumitem}
\usepackage{multicol}
\usepackage{tasks}
\usepackage{tikz, tkz-euclide}
%%https://tex.stackexchange.com/questions/334787/constant-length-of-underline
\usepackage{eqparbox, ulem}
\newcommand\ulmakebox[2][ULB]{\eqsetminwidth{#1}{10cm}\underline{\eqmakebox[#1]{#2}}}
\newcommand{\wideunderline}[2][2em]{%
\underline{\makebox[\ifdim\width>#1\width\else#1\fi]{#2}}%
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\begin{minipage}{5cm}
\noindent (line 1) $\mathbf{u+w=v+w},$
\noindent (line 2) $\mathbf{u+w=v+w},$
\noindent (line 3) $\mathbf{u+w=v+w},$
\noindent (line 4) $\mathbf{u+w=v+w},$
\noindent (line 5) $\mathbf{u+w=v+w},$
\noindent (line 6) $\mathbf{u+w=v+w},$
\end{minipage}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\hspace*{4.4cm}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{minipage}{10cm}
\underline{text here (in front of line 1) \hspace{4cm}}
\underline{more text here (in front of line 2) \hspace{3cm}}
\noindent \ulmakebox{\noindent(in front of line 3)}
\wideunderline[10cm]{\noindent text here (in front of line 4)}
\begin{tikzpicture} %\without text line in front of line 5
\draw (0,0) to (10,0);
\end{tikzpicture}
\begin{tikzpicture} %\without text line in front of line 6
\draw (0,0) to (10,0);
\end{tikzpicture}
\end{minipage}
\end{document}