Suppose I have a long string and I copy it to the clipboard:
s = "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345";
CopyToClipboard[s]
When I paste the clipboard contents into a text editor I get that string all on a single line.
But when I use
CopyToClipboard[{s}]
I get
{"12345678901234567890123456789012345678901234567890123456789012345678\
90123456789012345"}
How can I avoid the line splitting? I see Options
and Streams
and TotalWidth
in the documentation but I can't make heads or tails of any of it.
(You might wonder why I'm using {s}
rather than just s
: That seems to be the only way I can get a CDF document to copy anything to the clipboard.)
Answer
Converting a comment to an answer, in the 10.1.0 Front End this works:
SetOptions[$FrontEndSession,
{"PageWidth" -> 1000, "ExportTypesetOptions" -> {"PageWidth" -> 1000}}]
I do not use CDF so I do not know how this relates.
I found that I needed to set both options shown or the copy would still wrap. The value 1000 was purely arbitrary; Infinity
may suit your needs better.
Comments
Post a Comment