\Verb
我现在在使用包中的命令时遇到问题fvextra
,该命令可以用作包的直接替代品fancyvrb
。如果尚未加载,它将fvextra
加载,然后继续修补和定义其他功能。加载包以提供正确的反引号( )和打字机单引号()。当我尝试使用该命令生成内联逐字文本时,封闭的文本会溢出行边距而没有换行符。fancyvrb
fancyvrb
upquote
`
'
\Verb
\Verb
根据 的文档fvextra
,我们应该使用\Verb
并带有以下选项:breaklines, breakafter=fun, breaksymbolright=-
,也就是说,我们应该输入一些如下的 LaTeX 代码:\Verb[breaklines, breakafter=fun, breaksymbolright=-]|'integer, float, cons, symbol, string, vector, hash-table, subr, byte-code function, and record'|
。但是上述情况还会出现另一个问题:换行符最终以一个符号结束,right floor
而不是hyphenation
我想要的符号。
我的问题是:如何用right floor ⌋
符号替换hyphenation -
符号?
顺便说一句:我使用了TeX Live-2022
,xeLaTeX
引擎,并Sublime Text 4
使用进行了编译macOS Sierra-Version 10.12.6
。
我的MWE如下:
\documentclass[a4paper,twoside,11pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[greek,french,english]{babel}
\usepackage{amssymb,amsmath,amsthm}
\usepackage{fancyvrb}
\usepackage{fvextra}
\usepackage{etoolbox}
\usepackage{ifthen}
\usepackage[svgnames,hyperref]{xcolor}
\usepackage[headheight=15pt,top=2.54cm,bottom=2.54cm,left=3.81cm,right=3.54cm]{geometry}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[CO]{Tex Test}
\fancyhead[CE]{Rédigé par Alex}
\fancyhead[LE,RO]{\oldstylenums{\thepage}}
\renewcommand{\headrulewidth}{0pt}
\begin{document}
A Lisp \verb|'object'| is a piece of data used and manipulated by Lisp programs. For our purposes, a \verb|'type'| or \verb|'data type'| is a set of possible objects. Every \verb|'object'| belongs to at least one \verb|'type'|, but types can overlap, so objects can belong to two or more types. \\
Primitive types: A few fundamental object types are built into Emacs. These, from which all other types are constructed, are called \verb|'primitive'| types. Each object belongs to one and only one primitive type. These types include \Verb[breaklines, breakafter=fun, breaksymbolright=-]|'integer, float, cons, symbol, string, vector, hash-table, subr, byte-code function, and record'| plus several special types, such as \verb|'buffer'|, that are related to editing.\\
\end{document}
答案1
你要breakaftersymbolpre
。
请注意,breakafter
将允许中断的字符列表作为值,而不是字符串。
\documentclass[a4paper,twoside,11pt]{article}
\usepackage{fvextra}
\usepackage[headheight=15pt,top=2.54cm,bottom=2.54cm,left=3.81cm,right=3.54cm]{geometry}
\begin{document}
A Lisp \verb|'object'| is a piece of data used and manipulated by
Lisp programs. For our purposes, a \verb|'type'| or \verb|'data type'|
is a set of possible objects. Every \verb|'object'| belongs to at least
one \verb|'type'|, but types can overlap, so objects can belong to
two or more types.
Primitive types: A few fundamental object types are built into Emacs.
These, from which all other types are constructed, are called
\verb|'primitive'| types. Each object belongs to one and only one
primitive type. These types include
\Verb[
breaklines,
breakafter=fun,
breakaftersymbolpre=-,
]|'integer, float, cons, symbol, string, vector, hash-table, subr, byte-code function, and record'|
plus several special types, such as \verb|'buffer'|, that are related to editing.
\end{document}
我删除了与问题无关的所有内容,但请注意,fontenc
几乎永远都不应加载 XeLaTeX,而且inputenc
根本不应加载。
\\
另外,永远不要在段落末尾使用。永远不要。