迷你頁:每行末尾的單字接觸迷你頁的邊框,但不超出空間

迷你頁:每行末尾的單字接觸迷你頁的邊框,但不超出空間

當我避開行尾的空格時。我希望每行的最後一個單字能夠觸及小頁的邊緣,但不要超過它。每一行必須保持原樣,不應刪除或包含單詞,也不應更改兩行之間的單字。我無法使用 \ spaceskip 單獨重新排列每一行。每行的第一個單字應接觸迷你頁的右邊緣,如下圖所示。最後單字的分佈應該是一致的。只要該單字保留在文字中,只有一個單字的行就不是問題。我想知道一個全域的解決方案,像是樣式、套件、指令等。

文字樣本

\documentclass{article}
\usepackage{fancybox,anyfontsize,geometry,setspace}
\thispagestyle{empty}
\paperwidth=15.0in
\paperheight=13.0in
\addtolength{\textwidth}{12.55in}
\addtolength{\textheight}{6.90in}
\begin{document}
\fbox{
\begin{minipage}{0.45\textwidth}
    \begin{spacing}{9}  
\fontsize{40}{6}\selectfont

\spaceskip=1.78\fontdimen2\font plus 1.2\fontdimen3\font minus 1.2\fontdimen4\font 
Deep down, I know I do \\
great work! I literally \\
study every single day, \\
and I work on huge projects at work. I've been in \\
the field for over 15 years. I work with \\
and even challenge some of the \\
best developers.
\end{spacing}
\end{minipage}
} 
\end{document}

嗨@leandriis,這裡是使用 \makebox[\linewidth][s] 的程式碼:

\documentclass{article}
\usepackage{fancybox,anyfontsize,geometry,setspace}
\thispagestyle{empty}
\paperwidth=15.0in
\paperheight=13.0in
\addtolength{\textwidth}{12.55in}
\addtolength{\textheight}{6.90in}
\begin{document}
\fbox{
\begin{minipage}{0.45\textwidth}
    \begin{spacing}{9}  
\fontsize{40}{6}\selectfont

\spaceskip=1.78\fontdimen2\font plus 1.2\fontdimen3\font minus 1.2\fontdimen4\font 
\makebox[\linewidth][s]{Deep down, I know I do} \\
\makebox[\linewidth][s]{great work! I literally} \\
\makebox[\linewidth][s]{study every single day,} \\
\makebox[\linewidth][s]{and I work on huge projects at work. I've been in} \\
\makebox[\linewidth][s]{the field for over 15 years. I work with} \\
\makebox[\linewidth][s]{and even challenge some of the} \\
\makebox[\linewidth][s]{best developers.}
\end{spacing}
\end{minipage}
} 
\end{document}

和結果

不工作

答案1

我不確定,但我認為你在要求

在此輸入影像描述

\documentclass{article}
\usepackage{fancybox,anyfontsize,geometry,setspace}
\thispagestyle{empty}
\paperwidth=15.0in
\paperheight=13.0in
\addtolength{\textwidth}{12.55in}
\addtolength{\textheight}{6.90in}
\begin{document}
\fbox{
\begin{minipage}{0.45\textwidth}
    \begin{spacing}{9}  
\fontsize{40}{6}\selectfont

\emergencystretch\linewidth\parfillskip0pt
Deep down, I know I do\linebreak
great work! I literally\linebreak
study every single day,\linebreak
and I work on huge projects at work. I've been in\linebreak
the field for over 15 years. I work with\linebreak
and even challenge some of the\linebreak
best developers.
\end{spacing}
\end{minipage}
} 
\end{document}

相關內容