如何在 Latex 中实现不间断的文本换行?
我需要在我的乳胶文档中插入这样的文本:
((((tetrameristaceae,pellicieraceae),marcgraviaceae),balsaminaceae),(fouquieriaceae,polemoniaceae,sladeniaceae,(ternstroemia,adinandra)pentaphylacaceae,(schima,gordonia)theaceae,(lissocarpa ,diospyros) ebenaceae, symlocaceae,(maesaceae,(theophrastaceae,(primulaceae,(myrsine,ardisia)myrsinaceae))),(diapensiaceae,(parastyrax,styrax)styracaceae),sapotaceae,(barringtonia,gustavia)lecythidaceae,(((杜鹃花科) ,cyrillaceae),(purdiaea,clethra)clethraceae),(瓶子草科,((猕猴桃,saurauia)猕猴桃科,roridulaceae)))))ericales;
Latex 将所有文本写在一行中,远离右边距。 我无法手动使用 \linebreak,当文本较长时,这只会给出很差的结果,并且考虑到要包含所有类似的文本,这将需要大量工作。
任何想法?
谢谢!
I need to insert text like this in my Latex document:
((((tetrameristaceae,pellicieraceae),marcgraviaceae),balsaminaceae),(fouquieriaceae,polemoniaceae,sladeniaceae,(ternstroemia,adinandra)pentaphylacaceae,(schima,gordonia)theaceae,(lissocarpa,diospyros)ebenaceae,symplocaceae,(maesaceae,(theophrastaceae,(primulaceae,(myrsine,ardisia)myrsinaceae))),(diapensiaceae,(parastyrax,styrax)styracaceae),sapotaceae,(barringtonia,gustavia)lecythidaceae,(((ericaceae,cyrillaceae),(purdiaea,clethra)clethraceae),(sarraceniaceae,((actinidia,saurauia)actinidiaceae,roridulaceae)))))ericales;
Latex writes the all text in one line, going way off in the right margin. I cannot use \linebreak by hand, this just gives a poor result when the text is longer, and it would be a lot of work given all the similar text to include.
Any idea?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
你的问题缺乏对期望结果的定义,所以我只是尝试猜测。
最简单的想法:只需在每个逗号后添加空格即可。
Your question lacks the definition of the desired outcome, so I'll just try to guess.
Simplest idea: just add spaces after each comma.
您可以在文本中添加连字符提示:如果您将
\-
放入单词中(例如non\-writing
),LaTeX 将仅在这些位置处断开,但会在如有必要,这些职位。 不过,您会在断开位置看到一个连字符。另一种可能的选择可能是使用 hyphenat 包并定义逗号作为连字符。 由于我自己从未使用过该软件包,所以我在这里可能是错的。
You could add hyphenation hints in the text: if you put
\-
in a word (for examplenon\-breaking
) LaTeX will break only at those position but will break at those positions if necessary. You'll get a hyphen at the breaking position though.Another possible option might be using the hyphenat package and defining the comma as your hyphenation character. As I never used that package myself I might be wrong here though.
我还没有尝试过,但看起来 newicktree 包可能会您感兴趣。 文章PHY·FI:快速、轻松地在线创建和操作系统发育彩色图< /a> 和相关的基于网络的工具似乎也就像他们会有所帮助一样。
编辑:我找到了一种方法,通过以几乎肯定不是预期的方式使用包来或多或少地完成你想要的事情。 这是 LaTeX 代码:
这是结果:
图片 http://img230.imageshack.us/img230/4705/newick.png
I haven't tried it, but it looks like the newicktree package may be of some interest to you. The article PHY·FI: fast and easy online creation and manipulation of phylogeny color figures and the associated web-based tool also seem like they would be helpful.
EDIT: I found a way to more or less accomplish what you want by using a package in a way that it almost certainly was not intended. Here is the LaTeX code:
Here is the result:
IMAGE http://img230.imageshack.us/img230/4705/newick.png
这是一个快速解决方案,可以部分实现(据我所知)。 它不需要对标记进行任何更改,但允许您根据需要自动插入额外的空格。
Here's a quick solution that gets part of the way there (as far as I can tell). It doesn't require any changes to the markup, but allows you to insert extra spaces if you like automatically.
据我所知,您可以在节点之间放置空格并使用通常的换行符。 您还可以通过在单词中插入
\-
来引入可选的连字符(使用连字符)。如果您(或任何必须批准您的工作的人)坚持任意中断,也许您可以使用 seqsplit包裹。
As far as I know, you can put whitespace between nodes and have the usual linebreaks. You can also introduce optional hyphenations (with a hyphen) by inserting
\-
in the words.If you (or whoever has to approve your work) insists on arbitrary breaks, perhaps you can use the seqsplit package.