Word wrap is a word processing feature that forces all text to be confined within defined margins. When a line of text is filled, the word processor automatically moves the text to the next line, so the user doesn't have to press the return key after every line. Word wrap also occurs if the document's margins are changed. Show
Word wrap is a text editor or word processor feature that breaks lines between words to adjust them within specified margins. This action is performed on the fly; if the user changes the margin, the line is automatically repositioned to ensure that the text is within margins and is visible. Breaks that occur as a result of word wrapping are called soft returns, while hard returns create new paragraphs. Soft returns are placed at the end of complete words or following the punctuation at the end of a sentence. Words without hyphens may also be wrapped to the following line using soft hyphens. Word wrapping is performed using algorithms. It is generally implemented based on minimum word length to provide the best appearance and readability.
Share this Term
Updated: 08/02/2020 by Computer Hope Word wrap may refer to any of the following: 1. Sometimes referred to as a run around and wrap around, word wrap is a feature in text editors and word processors. It moves the cursor to the next line when reaching the end without requiring you to press Enter. For example, in the picture below, as each section shrinks, the sentence is wrapped, so it doesn't extend past the border. You can see a live example of how text wraps by resizing the browser window on this page. In textarea fields, the cursor automatically moves to the next line when it reaches the edge of the box. You can test this in the textarea below. Why is word wrapping used?Word wrapping is used to help contain text within an area and to prevent text from being cut off or missed. For example, all of the text contained on this page is wrapped in an HTML div tag for easy reading. If there were no word wrapping, you would have to scroll horizontally (left-to-right) instead of vertically (up and down) on any long line of text. Turning off word wrapWord wrap is often set up by default and can be turned off by enabling hyphenation, clicking the word wrap button, or adjusting the program's settings. The picture shows an example of what a word wrap button may look like or resemble for programs that have the option. Note If word wrap is disabled, when typing, the line of text continues horizontally on the same line until the Enter key is pressed. Why would someone turn off word wrap?When working with files that contain long lines of text, it may be easier to view and find text with word wrap turned off. For example, if you had a .csv file with several values per line, you can see the beginning of each row more easily if you disable word wrap. How to wrap text at a certain number of charactersYou can use our text tool to wrap any text at a certain length. For example, if you wanted to wrap your text at 100 character length you can paste your text into the tool and enter "100" into the "wrap text at" section. 2. In Microsoft Excel and other spreadsheet programs, word wrap is more commonly referred to as Wrap Text. Alignment, Soft return, Text wrap, Word, Word processor terms
‹ Word Processor | WordArt ›
The definition of Word Wrap on this page is an original TechTerms.com definition. If you would like to reference this page or cite this definition, you can use the green citation links above. The goal of TechTerms.com is to explain computer terminology in a way that is easy to understand. We strive for simplicity and accuracy with every definition we publish. If you have feedback about the Word Wrap definition or would like to suggest a new technical term, please contact us. Want to learn more tech terms? Subscribe to the daily or weekly newsletter and get featured terms and quizzes delivered to your inbox. This article's use of external links may not follow Wikipedia's policies or guidelines.(March 2015) Line breaking, also known as word wrapping, is breaking a section of text into lines so that it will fit into the available width of a page, window or other display area. In text display, line wrap is continuing on a new line when a line is full, so that each line fits into the viewable window, allowing text to be read from top to bottom without any horizontal scrolling. Word wrap is the additional feature of most text editors, word processors, and web browsers, of breaking lines between words rather than within words, where possible. Word wrap makes it unnecessary to hard-code newline delimiters within paragraphs, and allows the display of text to adapt flexibly and dynamically to displays of varying sizes.
A soft return or soft wrap is the break resulting from line wrap or word wrap (whether automatic or manual), whereas a hard return or hard wrap is an intentional break, creating a new paragraph. With a hard return, paragraph-break formatting can (and should) be applied (either indenting or vertical whitespace). Soft wrapping allows line lengths to adjust automatically with adjustments to the width of the user's window or margin settings, and is a standard feature of all modern text editors, word processors, and email clients. Manual soft breaks are unnecessary when word wrap is done automatically, so hitting the "Enter" key usually produces a hard return.
Alternatively, "soft return" can mean an intentional, stored line break that is not a paragraph break. For example, it is common to print postal addresses in a multiple-line format, but the several lines are understood to be a single paragraph. Line breaks are needed to divide the words of the address into lines of the appropriate length.
In the contemporary graphical word processors Microsoft Word and OpenOffice.org, users are expected to type a carriage return (↵ Enter) between each paragraph. Formatting settings, such as first-line indentation or spacing between paragraphs, take effect where the carriage return marks the break. A non-paragraph line break, which is a soft return, is inserted using ⇧ Shift+↵ Enter or via the menus, and is provided for cases when the text should start on a new line but none of the other side effects of starting a new paragraph are desired.
In text-oriented markup languages, a soft return is typically offered as a markup tag. For example, in HTML there is a <br> tag that has the same purpose as the soft return in word processors described above. UnicodeThe Unicode Line Breaking Algorithm determines a set of positions, known as break opportunities, that are appropriate places in which to begin a new line. The actual line break positions are picked from among the break opportunities by the higher level software that calls the algorithm, not by the algorithm itself, because only the higher level software knows about the width of the display the text is displayed on and the width of the glyphs that make up the displayed text.[1] The Unicode character set provides a line separator character as well as a paragraph separator to represent the semantics of the soft return and hard return. 0x2028 LINE SEPARATOR * may be used to represent this semantic unambiguously 0x2029 PARAGRAPH SEPARATOR * may be used to represent this semantic unambiguouslyThe soft returns are usually placed after the ends of complete words, or after the punctuation that follows complete words. However, word wrap may also occur following a hyphen inside of a word. This is sometimes not desired, and can be blocked by using a non-breaking hyphen, or hard hyphen, instead of a regular hyphen. A word without hyphens can be made wrappable by having soft hyphens in it. When the word isn't wrapped (i.e., isn't broken across lines), the soft hyphen isn't visible. But if the word is wrapped across lines, this is done at the soft hyphen, at which point it is shown as a visible hyphen on the top line where the word is broken. (In the rare case of a word that is meant to be wrappable by breaking it across lines but without making a hyphen ever appear, a zero-width space is put at the permitted breaking point(s) in the word.) Sometimes word wrap is undesirable between adjacent words. In such cases, word wrap can usually be blocked by using a hard space or non-breaking space between the words, instead of regular spaces. In Chinese, Japanese, and Korean, word wrapping can usually occur before and after any Han character, but certain punctuation characters are not allowed to begin a new line.[2] Japanese kana, letters of the Japanese alphabet, are treated the same way as Han Characters (Kanji) by extension, meaning words can, and tend to be broken without any hyphen or other indication that this has happened. Under certain circumstances, however, word wrapping is not desired. For instance,
Most existing word processors and typesetting software cannot handle either of the above scenarios. CJK punctuation may or may not follow rules similar to the above-mentioned special circumstances. It is up to line breaking rules in CJK. A special case of line breaking rules in CJK, however, always applies: line wrap must never occur inside the CJK dash and ellipsis. Even though each of these punctuation marks must be represented by two characters due to a limitation of all existing character encodings, each of these are intrinsically a single punctuation mark that is two ems wide, not two one-em-wide punctuation marks. Word wrapping is an optimization problem. Depending on what needs to be optimized for, different algorithms are used. Minimum number of linesA simple way to do word wrapping is to use a greedy algorithm that puts as many words on a line as possible, then moving on to the next line to do the same until there are no more words left to place. This method is used by many modern word processors, such as OpenOffice.org Writer and Microsoft Word.[citation needed] This algorithm always uses the minimum possible number of lines but may lead to lines of widely varying lengths. The following pseudocode implements this algorithm: Where LineWidth is the width of a line, SpaceLeft is the remaining width of space on the line to fill, SpaceWidth is the width of a single space character, Text is the input text to iterate over and Word is a word in this text. Minimum raggednessA different algorithm, used in TeX, minimizes the sum of the squares of the lengths of the spaces at the end of lines to produce a more aesthetically pleasing result. The following example compares this method with the greedy algorithm, which does not always minimize squared space. For the input text AAA BB CC DDDDDwith line width 6, the greedy algorithm would produce: ------ Line width: 6 AAA BB Remaining space: 0 CC Remaining space: 4 DDDDD Remaining space: 1The sum of squared space left over by this method is 0 2 + 4 2 + 1 2 = 17 {\displaystyle 0^{2}+4^{2}+1^{2}=17} . However, the optimal solution achieves the smaller sum 3 2 + 1 2 + 1 2 = 11 {\displaystyle 3^{2}+1^{2}+1^{2}=11} : ------ Line width: 6 AAA Remaining space: 3 BB CC Remaining space: 1 DDDDD Remaining space: 1The difference here is that the first line is broken before BB instead of after it, yielding a better right margin and a lower cost 11. By using a dynamic programming algorithm to choose the positions at which to break the line, instead of choosing breaks greedily, the solution with minimum raggedness may be found in time O ( n 2 ) {\displaystyle O(n^{2})} , where n {\displaystyle n} is the number of words in the input text. Typically, the cost function for this technique should be modified so that it does not count the space left on the final line of a paragraph; this modification allows a paragraph to end in the middle of a line without penalty. It is also possible to apply the same dynamic programming technique to minimize more complex cost functions that combine other factors such as the number of lines or costs for hyphenating long words.[3] Faster but more complicated linear time algorithms based on the SMAWK algorithm are also known for the minimum raggedness problem, and for some other cost functions that have similar properties.[4][5] HistoryA primitive line-breaking feature was used in 1955 in a "page printer control unit" developed by Western Union. This system used relays rather than programmable digital computers, and therefore needed a simple algorithm that could be implemented without data buffers. In the Western Union system, each line was broken at the first space character to appear after the 58th character, or at the 70th character if no space character was found.[6] The greedy algorithm for line-breaking predates the dynamic programming method outlined by Donald Knuth in an unpublished 1977 memo describing his TeX typesetting system[7] and later published in more detail by Knuth & Plass (1981).
|