Sample Cell 1
Cell["Much of point set topology consists in developing a convenient language to talk about when various points in a space are near to one another and about the notion of continuity. The key is that the same definitions can be applied to many disparate branches of math.", "Text"]
Split to multiple cells like
Sample Cell 2
Cell["Much of point set topology consists in developing a convenient", "Text"]
Cell[" language to talk about when various points in a space are near", "Text"]
Cell[" to one another and about the notion of continuity. The key is", "Text"]
Cell[" that the same definitions can be applied to many disparate ", "Text"]
Cell["branches of math.", "Text"]
Though, in this example, they are all plaint text, maybe much simpler, the problem might be harder when there are many inline math cells.
Here is an sample post for why I need this, I wanna make first light-green block text into multiple framed lines like what below Definition 4.1.1. http://quaternions.blog.163.com/blog/static/206082147201356102512774/
Bill's present method will not able to deal with the inline cells.
Upadte sample Cell 3 with inline cells
Cell[TextData[{"Much of point set topology", Cell[BoxData[\(TraditionalForm\`\(\ consists\ \)\)], FormatType -> "TraditionalForm"], "in developing a convenient language to  talk about ", Cell[BoxData[\(TraditionalForm\`when\)], FormatType -> "TraditionalForm"], " various points in a space are near to one another and about the notion of ", Cell[BoxData[\(TraditionalForm\`\(continuity\^2\)\)], FormatType -> "TraditionalForm"], ". The key is that the same definitions can be applied to many disparate branches of math."}], "Text"]
Answer
Take the first cell and give it a name:
myCell=Cell["Much of point set topology consists in developing a convenient language to  talk about when various points in a space are near to one another and about the notion of continuity. The key is that the same definitions can be applied to many disparate branches of math.", "Text"]
Here's a function to break it into pieces with about n/2 words in each piece:
breakCell[str_, n_] := Cell /@ StringJoin /@ 
    Partition[Riffle[StringSplit[First[List @@ str]], " "], n]
For example, applying breakCell to myCell gives:
breakCell[myCell, 15]
{Cell["Much of point set topology consists in developing"], 
 Cell[" a convenient language to talk about when "], 
 Cell["various points in a space are near to"], 
 Cell[" one another and about the notion of "], 
 Cell["continuity. The key is that the same definitions"], 
 Cell[" can be applied to many disparate branches "]}
Comments
Post a Comment