{ "info": { "author": "A.M. Kuchling", "author_email": "amk@amk.ca", "bugtrack_url": null, "classifiers": [], "description": "tex_wrap v1.00\n==============\n\nThis is an implementation of the dynamic programming algorithm,\noriginally developed by D.E. Knuth and M.F. Plass, used by TeX to\nbreak a paragraph into lines. I won't describe the algorithm in\ndetail here; for a full explanation, see the chapter describing it in\nKnuth's book _Digital Typography_, which explains the theory and shows\nhow to use it to achieve various clever effects.\n\nThe interface is fairly simple. Create an ObjectList instance and\nfill it with a series of Box, Glue, and Penalty objects representing a\nsingle paragraph. When you've done that, call the ObjectList's\n.add_closing_penalty() method to add the standard glue and penalty for\na paragraph end. Then call its .compute_breakpoints() method which\ndoes all the work and returns a list of integers, which are the\nindexes at which the text should be broken.\n\nThe signature of this method is:\n def compute_breakpoints(self,\n line_lengths,\n looseness = 0,\n tolerance = 1,\n fitness_demerit = 100,\n flagged_demerit = 100,\n ):\n\nline_lengths is the only required parameter, and is a list of integers\ngiving the lengths of each line. The last element of the list is\nreused for subsequent lines. So you can pass [100] for a paragraph\nthat's 100 units wide, or range(140, 20, -10) for a triangular\nparagraph. There's no particular unit for width, so you can work in\npoints or pixels or whatever you like.\n\nThe rest of the parameters are optional. looseness is an integer\nvalue. If it's positive, the paragraph will be set to take that many\nlines more than the optimum value, so you can make a paragraph take up\nan extra line. If it's negative, the paragraph is set that many lines\ntighter, if possible; usually you'll only manage to set it a single\nline tighter. looseness defaults to zero, meaning the optimal length\nfor the paragraph.\n\ntolerance is the maximum adjustment ratio allowed for a line. It\ndefaults to 1, meaning that all the glue on the line is stretched up\nto its specified stretch value.\n\nfitness_demerit is additional value added to the demerit score when\ntwo consecutive lines are in different fitness classes. There are\nfour classes: very tight, tight, loose, and very loose. The algorithm\ntries to avoid having a very tight line next to a very loose line,\nbecause the difference is visible and distracting.\n\nflagged_demerit is an additional value added to the demerit score when\nbreaking at the second of two flagged penalties.\n\nOnce you've got the list of optimal breakpoints, formatting and\noutputting the text is up to you; I haven't implemented an API for\nthis because I have no idea what such an API would look like. Box\ninstances have a 'character' attribute that you can specify, so you\ncan set this to the character for a given box for later use by an\noutput pass. (It needn't be a character; you could set it to an\narbitrary object if you like, though then the name is rather\nmisleading.)\n\nBug reports, sample code, and notes about the module's usage are\nwelcome; please send them to .\n\n--\nA.M. Kuchling \t\t\thttp://www.amk.ca\n", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "UNKNOWN", "keywords": null, "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "texlib", "package_url": "https://pypi.org/project/texlib/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/texlib/", "project_urls": { "Download": "UNKNOWN", "Homepage": "UNKNOWN" }, "release_url": "https://pypi.org/project/texlib/0.01/", "requires_dist": null, "requires_python": null, "summary": "A package of Python modules for dealing with various TeX-related file formats.", "version": "0.01" }, "last_serial": 1501535, "releases": { "0.01": [ { "comment_text": "", "digests": { "md5": "86882058e8e8873b7723da93367af4f9", "sha256": "ee33c8835b0ca86f958baa0344af588aaa144b7d86a9eb693d6f469f2cdc7d4b" }, "downloads": -1, "filename": "texlib-0.01.tar.gz", "has_sig": false, "md5_digest": "86882058e8e8873b7723da93367af4f9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7783, "upload_time": "2015-04-11T18:36:43", "url": "https://files.pythonhosted.org/packages/e5/c6/29d101f73c9b0ddf1714ec0f58490785d31ffe898f5210962473bd2bf05d/texlib-0.01.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "86882058e8e8873b7723da93367af4f9", "sha256": "ee33c8835b0ca86f958baa0344af588aaa144b7d86a9eb693d6f469f2cdc7d4b" }, "downloads": -1, "filename": "texlib-0.01.tar.gz", "has_sig": false, "md5_digest": "86882058e8e8873b7723da93367af4f9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7783, "upload_time": "2015-04-11T18:36:43", "url": "https://files.pythonhosted.org/packages/e5/c6/29d101f73c9b0ddf1714ec0f58490785d31ffe898f5210962473bd2bf05d/texlib-0.01.tar.gz" } ] }