Discussion:
using ellipsis in disp-statement
(too old to reply)
nukeymusic
2011-10-17 08:28:11 UTC
Permalink
As I want to include my octave-code verbatim in my LaTeX-documents I
try to make the octave-statements in my .m-files not too long. When
using an ellipsis however within a disp-statement things go wrong:
disp('First part of a long string of text...
followed by continuation of a long sentence')


How can I achieve this (of course I want the solution to still split
the
phrase over more than one line in the m-file but not necessarily in
the result displayed)

thanks
nukey
Christoph Brinkhaus
2011-10-18 19:19:01 UTC
Permalink
nukeymusic <***@gmail.com> schrieb:

Dear Nukey,
Post by nukeymusic
As I want to include my octave-code verbatim in my LaTeX-documents I
try to make the octave-statements in my .m-files not too long. When
disp('First part of a long string of text...
followed by continuation of a long sentence')
How can I achieve this (of course I want the solution to still split
the
phrase over more than one line in the m-file but not necessarily in
the result displayed)
One option would be to put the desired output
in different string variables. The resulting number of letters
would depend on how many pieces you would generate from a certain
single comment line.

This can be used to reduce the letters per line for Latex.

For the output on the terminal you can either concat the
strings somehow and use the disp function or you use
printf if possible.

This might not be the most elegant way but it should work...
I am not aware of a linebreak syntax which tells the interpreter
to join the corresponding lines. An example in a different
language is the backslash in the Tcl syntax.
Post by nukeymusic
thanks
nukey
I hope my reply is at least little bit helpful.
The proposal is quite ugly. Maybe soembody has a
better idea.

Kind regards,

Christoph
nukeymusic
2011-10-20 12:38:45 UTC
Permalink
Post by Christoph Brinkhaus
Dear Nukey,
Post by nukeymusic
As I want to include my octave-code verbatim in my LaTeX-documents I
try to make the octave-statements in my .m-files not too long. When
disp('First part of a long string of text...
followed by continuation of a long sentence')
How can I achieve this (of course I want the solution to still split
the
phrase over more than one line in the m-file but not necessarily in
the result displayed)
One option would be to put the desired output
in different string variables. The resulting number of letters
would depend on how many pieces you would generate from a certain
single comment line.
This can be used to reduce the letters per line for Latex.
For the output on the terminal you can either concat the
strings somehow and use the disp function or you use
printf if possible.
This might not be the most elegant way but it should work...
I am not aware of a linebreak syntax which tells the interpreter
to join the corresponding lines. An example in a different
language is the backslash in the Tcl syntax.
Post by nukeymusic
thanks
nukey
I hope my reply is at least little bit helpful.
The proposal is quite ugly. Maybe soembody has a
better idea.
Kind regards,
Christoph
Thanks for you reply Christoph, I got this workaround from someone
else:

disp( [ 'First part of a long string of text' ...
' followed by continuation of a long sentence'...
' and even more text' ] )

Loading...