literalinclude and long lines

43 views
Skip to first unread message

Jan Ulrich Hasecke

unread,
Jun 27, 2014, 5:59:14 PM6/27/14
to sphinx...@googlegroups.com
Hi,

I include a file with literalinclude. Some lines of the file are too
long to be displayed inside the text margins. I cannot alter the file
and I want to preserve line counting because I refer to line numbers in
my explanations.

Can I somehow wrap long lines in literal includes automatically?

juh

--
Software-Dokumentation mit Sphinx
http://www.amazon.de/dp/1497448689/
Paperback: 224 Seiten

Takayuki Shimizukawa

unread,
Jul 1, 2014, 6:17:04 PM7/1/14
to sphinx...@googlegroups.com
Hi,

I think there is no way to wrap lines with using :linenos: option.
However, I can suggest a workaround for the problem of long lines
protrude from the screen.

1. add _static/custom.css file as::

table.highlighttable {
table-layout: fixed;
width: 100%;
}

table.highlighttable td.linenos {
width: 1em;
}

table.highlighttable td.linenos div.linenodiv {
text-align: right;
}

2. add setup function to conf.py as::

def setup(app):
app.add_stylesheet('custom.css')

Then, you'll get similar looks as non :linenos: output.
Regards,
--
Takayuki SHIMIZUKAWA
http://about.me/shimizukawa
> --
> You received this message because you are subscribed to the Google Groups "sphinx-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sphinx-users...@googlegroups.com.
> To post to this group, send email to sphinx...@googlegroups.com.
> Visit this group at http://groups.google.com/group/sphinx-users.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages