我的描述环境有问题。文本超出了页面宽度
\documentclass[a4paper,twoside,10pt]{report}
\usepackage[francais]{babel}
\usepackage[T1]{fontenc}
\usepackage[ansinew]{inputenc}
\usepackage{lmodern}
\usepackage{geometry}
\geometry{hmargin=2.5cm,vmargin=2.5cm}
\begin{document}
\pagestyle{empty}
\chapter{Some small hints}\label{hints}
\section{German Umlauts and other Language Specific Characters}\label{umlauts}
You can type german umlauts like 'ä', 'ö', or 'ü' directly in this file.
\begin{description}
\item [small item:] Lorem ipsum dolor sit amet, consectetur adipiscing elit.
\item [Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse consequat accumsan sodales. Duis pulvinar sagittis porta. Mauris malesuada vehicula turpis,] sed ornare ante. In pulvinar ligula a leo lacinia, vel laoreet tortor auctor. Nullam in tinc] Lorem ipsum dolor sit amet, consectetur adipiscing elit.
\end{description}
\end{document}
这是输出:
有没有解决方案可以确保文本自动转到新行?谢谢
答案1
您可以使用包sameline
中的选项来执行此操作enumitem
。顺便说一句,我将输入 enncoding 更改为utf8
,因为它更易于移植到另一个平台:
\documentclass[a4paper,twoside,10pt]{report}
\usepackage[francais]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{geometry}
\geometry{margin=2.5cm, showframe, nomarginpar}
\usepackage{enumitem}
\AtBeginDocument{\def\chaptername{Le Chapter}}
\begin{document}
\pagestyle{empty}
\chapter{Some small hints}\label{hints}
\section{German Umlauts and other Language Specific Characters}\label{umlauts}
You can type german umlauts like 'ä', 'ö', or 'ü' directly in this file.
\begin{description}[style =sameline]
\item [small item:] Lorem ipsum dolor sit amet, consectetur adipiscing elit.
\item [Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse consequat accumsan sodales. Duis pulvinar sagittis porta. Mauris malesuada vehicula turpis,] sed ornare ante. In pulvinar ligula a leo lacinia, vel laoreet tortor auctor. Nullam in tinc]
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
\end{description}
\end{document}
答案2
加载 可enumitem
为您提供 的各种样式选项description
。例如unboxed
允许多行标签:
\documentclass[a4paper,twoside,10pt]{report}
\usepackage[francais]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{enumitem}
\begin{document}
\begin{description}[style=unboxed]
\item [small item:] Lorem ipsum dolor sit amet, consectetur adipiscing elit.
\item [Lorem ipsum dolor sit amet, consectetur adipiscing
elit. Suspendisse consequat accumsan sodales. Duis pulvinar sagittis
porta. Mauris malesuada vehicula turpis,] sed ornare ante. In
pulvinar ligula a leo lacinia, vel laoreet tortor auctor. Nullam in
tinc] Lorem ipsum dolor sit amet, consectetur adipiscing elit.
\end{description}
\end{document}