前の行で and を使用すると\hfill
、最後の単語がハイフンで区切られるため、 the は\hfill
通常と同じようには機能しません。
\documentclass[a4paper, 12pt]{book}
\begin{document}
Spellings attempt to transcribe the sounds of the language into
alphabetic letters, but phonetic spellings are exceptions \hfill go to library
AA Spellings attempt to transcribe the sounds of the language into
alphabetic letters, but phonetic spellings \hfill go to library
\end{document}
例の\hfill
最初のように動作させるには、何を書けばよいでしょうか?\hfill
答え1
最初の解決策は、私の解決策の修正版です。スペースがない場合は右揃えのテキストを次の行に移動する
どこで失敗する可能性があるかを確認するために、David の解決策も示します。
\documentclass[a4paper, 12pt,draft]{book} % draft for showing the overfull boxes
\newcommand*{\gotoend}[1]{%
\unskip
{\nobreak\hfill\penalty50\ \null\nobreak
\hfill\mbox{#1}%
\parfillskip=0pt \finalhyphendemerits=0 \par}
}
%% David's version
\newcommand*{\Dgotoend}[1]{\unskip\hspace*{\fill}\mbox{ #1}}
\begin{document}
Spellings attempt to transcribe the sounds of the language into
alphabetic letters, but phonetic spellings are exceptions \gotoend{go to library}
AA Spellings attempt to transcribe the sounds of the language into
alphabetic letters, but phonetic spellings \gotoend{go to library}
AA Spellings attempt to transcribe the sounds of the language into
alphabetic letters, but AA phonetic spellings are just bigger
exceptions \gotoend{go to library}
David's version:
Spellings attempt to transcribe the sounds of the language into
alphabetic letters, but phonetic spellings are exceptions \Dgotoend{go to library}
AA Spellings attempt to transcribe the sounds of the language into
alphabetic letters, but phonetic spellings \Dgotoend{go to library}
AA Spellings attempt to transcribe the sounds of the language into
alphabetic letters, but AA phonetic spellings are just bigger exceptions \Dgotoend{go to library}
\end{document}
答え2
この動作は実際にはハイフネーションとは関係ありませんが、最後のフレーズが行をまたいで分割されるのを避けたいだけだと思います。
\documentclass[a4paper, 12pt]{book}
\begin{document}
Spellings attempt to transcribe the sounds of the language into
alphabetic letters, but phonetic spellings are exceptions\hspace*{\fill}\mbox{ go to library}
AA Spellings attempt to transcribe the sounds of the language into
alphabetic letters, but phonetic spellings\hspace*{\fill}\mbox{ go to library}
\end{document}
これをマクロにして(そしてegregの指摘に対処するために)
\documentclass[a4paper, 12pt,draft]{book} % draft for showing the overfull boxes
%% David's version
\newcommand*{\Dgotoend}[1]{\unskip\hfill\penalty9999\hspace*{\fill}\mbox{ #1}}
\begin{document}
David's version:
Spellings attempt to transcribe the sounds of the language into
alphabetic letters, but phonetic spellings are exceptions \Dgotoend{go to library}
AA Spellings attempt to transcribe the sounds of the language into
alphabetic letters, but phonetic spellings \Dgotoend{go to library}
AA Spellings attempt to transcribe the sounds of the language into
alphabetic letters, but AA phonetic spellings are just bigger exceptions \Dgotoend{go to library}
\end{document}