emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] Forcing line breaks in src (monospace) examples


From: Peter Davis
Subject: [O] Forcing line breaks in src (monospace) examples
Date: Sun, 14 Jun 2015 10:44:59 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:31.0) Gecko/20100101 Thunderbird/31.7.0

I'm writing a document which includes several example commands, which I've wrapped in #+BEGIN_SRC/#+END_SRC.

In LaTeX/PDF export, these come out in Courier, as I hoped, but they run off the right edge of the page. For example:

#+BEGIN_SRC curl
curl -v -X GET -H "Authorization:...\",   \"access_token\": \"..." "http://blah.blah.blah.com/v1/REST_API_STUFF/..."
#+END_SRC

Years ago, someone on a TeX mailing list offered some code to force line breaking in \tt{...} code, with a \triangleright at the right margin to show the line overflowed. I think this was all it took:

% Define obj
{\catcode`\_=13\gdef_{{\tt\char`\_}%
\discretionary{\rlap{$\triangleright$}}{\llap{$\triangleright$}}{}}}
\def\obj{\bgroup\catcode`\_=13\hyphenpenalty=10000\relax\sf\sc\endobj}
\def\endobj#1{#1\egroup}

However, I'm not enough of a TeX wiz to know how to make this work with org-mode, or even if I can. I tried replacing the above with:

#+BEGIN_LaTeX
curl -v -X GET -H "Authorization:...\",   \"access_token\": \"..." "http://blah.blah.blah.com/v1/REST_API_STUFF/..."
#+END_LaTeX

But (apart from the need to quote the backslashes, etc.), this didn't seem to do what I wanted.

Any suggestions on how to force line breaks?

Thank you!
-pd


reply via email to

[Prev in Thread] Current Thread [Next in Thread]