Text FormattingHyphenation in verbatim environment

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
I am Gianluca
Posts: 6
Joined: Wed Dec 21, 2011 4:23 pm

Hyphenation in verbatim environment

Post by I am Gianluca »

Hi all,
I want to insert on my dissertation thesis some piece of code from STATA. I've already thought about listings package but it doesn't recognise STATA's code. So, instead of using it I've tried the verbatim environment, which gives a better look in my own opinion.

Code: Select all

\begin{verbatim}
	mlogit financing relativvalue crossborder crosssector hostile restructuring recommended arrangement privatisation contested cashassumed debtcashfreebias exit publictakeover targetlisted earnout targetindepence acquirorindence shareholderprotection creditorprotection, base(4)
\end{verbatim}
This is the code that I need to write. Anything works fine but hyphenation.
I can't understand how hyphen on this environment maintaining a eyes candy justified format :?:

Thank you for your time,
Gianluca

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

5gon12eder
Posts: 126
Joined: Sun Feb 13, 2011 8:36 pm

Re: Hyphenation in verbatim environment

Post by 5gon12eder »

Even if the listings package doesn't have syntax highlighting predefined for your language, it will always do a job at least as good as the verbatim environment which never does highlighting. Why not use it?
I'm using pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian).
User avatar
skanda
Posts: 28
Joined: Sat May 16, 2009 6:32 pm

Re: Hyphenation in verbatim environment

Post by skanda »

I second the idea to use the listings package. I have used it myself and used it to span multiple pages with appropriate formatting. You can even go so far and define your own language's syntax or modify existing ones to match the same.

Perhaps, you ought to give it a try.

Another suggestion would be to use the tabbing command/package if the snippets are not too long.

Best,
Skanda.
I am Gianluca
Posts: 6
Joined: Wed Dec 21, 2011 4:23 pm

Hyphenation in verbatim environment

Post by I am Gianluca »

Thank you for the answers :)
You've got a point, but even with the listings package I haven't a great right alignment.
I upload a picture so you could better understand what I mean.
screenshot241211133919.png
screenshot241211133919.png (65.02 KiB) Viewed 3279 times
Triple / (///) means a hyphenation on STATA code only for writing pleasure. If I need to insert the code on STATA I should insert it in one string.
That trick is commonly used on papers, researches and help documentations for this software.
Post Reply