文本宽度对齐方式为 \hfill

文本宽度对齐方式为 \hfill

我可以像这样按定义的宽度自动对齐一些文本,仅使用文本字符串作为输入吗? 希望输出

例如,使用文本“文档工作组织理论基础”,我可以生成以下内容:

在此处输入图片描述

使用代码:

\parbox{\textwidth-25mm}{
\bf Theoretical \hfill bases \hfill of \hfill the \hfill organization
\hfill of \hfill work \hfill with \hfill documents
 }

但我需要手动放置\hfill。我可以编写命令或宏来重现这样的结果吗?

\somecommand{Theoretical bases of the organization of work with documents}

答案1

在此处输入图片描述

\documentclass{article}

\begin{document}

\begin{flushleft}

\makebox[.75\textwidth][s]{Theoretical bases of the organization of work with documents}

\makebox[.8\textwidth][s]{Theoretical bases of the organization of work with documents}

\makebox[.85\textwidth][s]{Theoretical bases of the organization of work with documents}

\makebox[.9\textwidth][s]{Theoretical bases of the organization of work with documents}

\makebox[.95\textwidth][s]{Theoretical bases of the organization of work with documents}

\makebox[\textwidth][s]{Theoretical bases of the organization of work with documents}

\end{flushleft}

\end{document}

相关内容