Text FormattingHow can I forbid something to be put at the end of a line?

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
hyc_n
Posts: 5
Joined: Thu Aug 30, 2012 9:45 am

How can I forbid something to be put at the end of a line?

Post by hyc_n »

I wrote several lines like

Code: Select all

\newcommand{\aaa}{{\bfseries\tiny a}}
\newcommand{\bbb}{{\bfseries\large b}}
which just print a number/letter formatted in some fixed way.
These number/letter will appear throughout the text very often.

But, sometimes the number/letter appear at the end of a line, the way which I do not prefer.

How can I rewrite so that the number/letter starts a new line if it comes very close to the end of a line?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

How can I forbid something to be put at the end of a line?

Post by localghost »

Please clarify the purpose of these commands and their application by a proper minimal example.


Thorsten
hyc_n
Posts: 5
Joined: Thu Aug 30, 2012 9:45 am

How can I forbid something to be put at the end of a line?

Post by hyc_n »

I am sorry for my not giving a minimal example.

Code: Select all

\documentclass{article}
\newcommand{\rrr}{{\sffamily\tiny\raisebox{0.2pc}{\=r}}}
\usepackage{CJKutf8}
\begin{document}
\begin{CJK*}{UTF8}{song}
一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二\rrr三四五六七八九十\par
one two three four five six seven eight nine ten one two three four five six \rrr seven eight nine ten
\end{CJK*}
\end{document}
Image
I want to have my "\rrr" start a new line in the Chinese example, as it does in the English example.

In English a space appears between words. This space also teaches LaTeX to start a new line if necessary. However,
no space is placed between CJK characters to separate words, so nothing can tell LaTeX to start a new line.

I failed to tell LaTeX to start a new line with "\rrr" unless I add a space somewhere appropriate, but this will results in undesired spaces. Can anyone help me tell LaTeX to start a new line with "\rrr" whenever it comes near the end of a line without adding a space, please?
Post Reply