Re: db2latex hyphenation in tt font
James Devenish <[email protected]> Wed, 10 Dec 2003 09:24:34 +0800
| Newsgroups | gmane.text.docbook.db2latex.general |
|---|---|
| Message-ID | <[email protected]> |
Hi, In message <[email protected]> on Tue, Dec 09, 2003 at 06:05:56PM +0000, Brian McGurk wrote: > Does anyone know how to enable hyphenation in typewriter fonts in > LaTeX? My document has a lot of long API function names which db2latex > formats using \texttt{ReallyLongFunctionName}. Many of these end up > spilling over the end of the line and LaTeX refuses to hypehenate and > break them. There are a number of approaches. But, basically, hyphenation is not easily supported for typewriter fonts. The DB2LaTeX snapshots provide workarounds by default, though the linebreaks occur only if the text contains punctuation. (There is also an alternative method, which is not enabled by default, but I think it has the same limitation). All I can think for a general solution to your problem is to produce a template that will allow hyphenation/linebreaks for capital letters (in addition to punctuation). Maybe this is a good idea for DB2LaTeX's default behaviour, too?? I imagine this "solution" would insert 'soft hyphens' before *every* capital letter. An alternative would be to allow linebreaks before every capital letter (i.e. don't insert the hyphen, just break the line). Maybe this should be configurable? Unfortunately, there's a problem implementing it: XSLT 1.0 doesn't have an efficient way to match 'capital letters' and EXSLT regex extensions are not widely supported. For you, perhaps you could use XML entities to assist. For example, replace: <function>ReallyLongFunctionName</function> with <!ENTITY ReallyLongFunctionName "<function>Really<?latex \-?>Long<?latex \-?>Function<?latex \-?>Name</function>"? ... &ReallyLongFunctionName; The ENTITY line is all one line. Ugly, I know, but it should work. Then, in the body of your document, use &ReallyLongFunctionName; to refer back to the entity. ------------------------------------------------------- This SF.net email is sponsored by: IBM Linux Tutorials. Become an expert in LINUX or just sharpen your skills. Sign up for IBM's Free Linux Tutorials. Learn everything from the bash shell to sys admin. Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click