合理文本中的标题参差不齐
我正在通过 pdflatex 使用 Latex 创建一个 pdf 文件,并希望标题包含不规则的文本,而文档的其余部分应使用合理的文本。
这给了我一个错误(!LaTeX错误:出了点问题——也许缺少\item
):
\usepackage{ragged2e}
..
\flushleft
\chapter{Something}
\justifying
并且这个弄乱了垂直间距:
{\raggedright{\chapter{Something}}}
这里有什么想法吗? 提前致谢!
I am creating a pdf file with Latex via pdflatex and want to have have headlines with ragged text, while the rest of the document should use justified text.
This gives me an error (! LaTeX Error: Something's wrong--perhaps a missing \item
):
\usepackage{ragged2e}
..
\flushleft
\chapter{Something}
\justifying
And this one messes up the vertical spacing:
{\raggedright{\chapter{Something}}}
Any idea here? Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
使用 sectsty 包并使用
\chapterfont{\raggedright}
使所有章节标题左对齐。 请参阅 sectsty 手册了解操作方法更有趣的事情。 如果sectsty不够强大,可以使用titlesec。 除此之外,您可以重新定义切片命令。Use the sectsty package and use
\chapterfont{\raggedright}
to make all chapter headings left justified. See the sectsty manual for how to do more interesting things. If sectsty is not powerful enough, titlesec can be used. Beyond that, you can redefine the sectioning commands.\chapter
、\section
等在标准类中可能有相当复杂的定义,这些定义有时会与强制以这种方式格式化的尝试产生不良交互。阅读标准类的描述,了解可以使用哪些变量来影响标题的外观。
您最好的选择可能是在 CTAN 上查找替代课程(
memoir
,也许)支持你想要的东西 -盒子。\chapter
,\section
and so on can have quite complicated definitions in the standard classes, which sometimes interact badly with attempts to force their formatting this way.Read the descriptions of the standard classes to find out what variable you can didle to affect the way the headings look.
Your best bet might be to look on CTAN for an alternate class (
memoir
, maybe) that support what you want out-of-the-box.请注意,加载
ragged2e
并使用\RaggedRight
命令而不是 LaTeX 的默认 \raggedright 是正确的。 尽管它确实会连字符,但有时它会提供更好的输出。 取决于您可能接受也可能不接受的标题设计。不管怎样,请遵循 @sgm 的使用 titlesec 的答案。 (它和 sectsty 一样容易使用,而且功能更强大......sectsty 仅适用于非常基本的重新定义,例如更改字体。)
Note that you're on the right track loading
ragged2e
and using the\RaggedRight
command instead of LaTeX's default \raggedright. It gives much better output some of the time, although it does hyphenate words; depending on the design of your headings that may or may not be acceptable to you.Either way, go with @sgm's answer of using titlesec. (It's as easy to use as sectsty, and more powerful...sectsty is only good for very basic redefinitions like changing the font.)
大约三年前,我厌倦了各种各样的软件包相互攻击,并且每个软件包都需要以自己特殊的方式进行调整,我将所有内容都切换到 回忆录。
我从未回头。
About three years ago, tired of having an assortment of packages shooting each other in the feet, and each one needing tweaking in its own special way, I switched everything to memoir.
I have never looked back.