我定义了一个\longName
命令:\newcommand*\longName[1]{\raggedright {\sloppy \textbf{#1}}}
但是我调用它之后,下面的文本就乱了,文本也变得乱七八糟,我不想这样。我只想让那段特定的文本乱七八糟。
\documentclass{article}
\usepackage[english]{babel}
\usepackage[left=2.5cm, right=2.5cm, top=2.5cm, bottom=2.5cm, noheadfoot]{geometry}
\usepackage{graphicx}
\usepackage{setspace}
\setlength\parindent{0pt}
\doublespacing
\newcommand*\longName[1]{\raggedright {\sloppy \textbf{#1}}}
\begin{document}
\longName{Long name containing several hyphens, and multiple lines}
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.\newline
\end{document}
答案1
你需要
\newcommand*\longName[1]{\par{\raggedright\textbf{#1}\par}}
\raggedright
在组内使用来控制其范围,在组内使用 以便段落在该范围内结束。在不规则设置中\par
用处不大,所以我删除了它。\sloppy