{"id":22258097,"url":"https://github.com/coot/sphinx_latex","last_synced_at":"2025-07-28T07:32:07.887Z","repository":{"id":7857967,"uuid":"9230100","full_name":"coot/sphinx_latex","owner":"coot","description":"LaTeX and HTML builders for Sphinx - Python documentation project","archived":false,"fork":false,"pushed_at":"2015-09-21T20:34:12.000Z","size":144,"stargazers_count":14,"open_issues_count":2,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2023-03-30T05:11:39.058Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/coot.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-04-04T23:16:23.000Z","updated_at":"2023-03-03T08:29:48.000Z","dependencies_parsed_at":"2022-09-03T06:52:24.899Z","dependency_job_id":null,"html_url":"https://github.com/coot/sphinx_latex","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coot%2Fsphinx_latex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coot%2Fsphinx_latex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coot%2Fsphinx_latex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coot%2Fsphinx_latex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coot","download_url":"https://codeload.github.com/coot/sphinx_latex/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227877782,"owners_count":17833559,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-03T08:13:28.725Z","updated_at":"2024-12-03T08:13:29.498Z","avatar_url":"https://github.com/coot.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Custom LaTeX and HTML builders for Sphinx - Python documentation tool\n=====================================================================\n\nThis is code contains LaTeX and HTML builders for Sphinx - the Python default\ndocumentation tool which uses the ReStructuredText (RST) file format.  It\nallows for custom build LaTeX documents: you can define your own LaTeX\npreambule, e.g.  use whatever class you would like to use (for example the\nmemoir class).  Also adds a few LaTeX type directives (align, theorem, definition,\netc)\n\nInstallation\n------------\n\nTo install the extension follow the standard\n[way](http://sphinx-doc.org/extensions.html), i.e. put the python files\nsomewhere in your $PYTHONPATH and add \"clatex_builder\" to `extensions` list in\nyour conf.py file.\n\noptions\n-------\n\nThe following options are recognised in the conf.py file:\n\n```\nclatex_documentclass\n```\nString option with the default value: `\\documentclass{book}\\n`: note that it\nshould provide whole document class command, not just the document class name.\nIn this way you can control document class options.\n\n```\nclatex_preambule\n```\nLaTeX preambule used added to the LaTeX source files.  It should not contain\nonly the document class statement.  This plugin will only add a minimal set of\nneeded LaTeX packages: hyperref, longtable, tabluary, multirow and possibly\nmakeidx package.  You can also add the attached tex/fresh.sty package.  It is\na simpler version of the original sphinx.sty package.  It does not use \\bf\nand \\rm commands (which are not always defined, c.f. memoir).  For more\ninformation see the package itself.\n\n```\nclatex_use_chapters\n```\nthis is a boolean option with the default value `True`.  If `False` the major\nsection unit will be `\\section` (what is useful for the article document\nclass).\n\n```\nclatex_begin_doc\n```\nBy default it is an empty string.  The value of this option will be added just\nafter `\\begin{document}` into the LaTeX source file.\n\n```\nclatex_end_doc\n```\nBy default it is an empty string.  The value of this option will be added just\nbefore `\\end{document}`.\n\n```\nclatex_highlighter\n```\nBoolean options, by default `True`.  If `True` a code highlighter will be\ninserted into LaTeX preambule.  You can turn it off if you are not writing\ncomputer related stuff where you do not need to highlight code snippets.\n\n```\nclatex_hyperref_args\n```\nString options, by default an empty string.  List of options added to the\ncommand `\\usepackage[...]{hyperref}`.\n\n```\nclatex_makeidx\n```\nBoolean option, by default `False`.  If `True` will add just\n`\\usepackage{makeidx}\\n\\makeindex` into the preamble.  If it is a string the\nstring will be added (in this way you can add options to the\n`\\usepackage{makeidx}` command.  You can use `clatex_end_doc` to insert the\n`\\printindex` command - it is not added by default!\n\n\n\ntheorems and newtheorem function\n--------------------------------\n\nFurthermore it allows you to define LaTeX like environments and use them in\nthe rst source files.  There are predefined directives:\n\n```\n.. theorem::\n\n.. proposition::\n\n.. definition::\n\n.. lemma::\n\n.. example::\n\n.. exercise::\n```\n\nThe directives work in a very similar way to the corresponding LaTeX\nenvironment: they all are numbered.  You can define your own environment.\nFor that you need to add your own [extension to\nSphinx](http://sphinx-doc.org/extensions.html) and add the following code to\nthe `setup` function:\n\n```\ndef setup(app)\n\n    newtheorem(app, 'theorem', 'Theorem', 'theorem')\n\n```\n\nThe `newtheorem()` function works in a very similar way to the LaTeX\n\\newtheorem{}{}{} command.  That means that the above code will define a `..\ntheorem::` directive, which will use `Theorem` as the environment name and the\ndirectives will be numbered like `theorem` (the third argument).  For example\nif you add also\n\n```\n    newtheorem(app, 'definition', 'Definition', 'theorem')\n```\n\nAll the definition directives will be counted together with theorem\ndirectives.  There is currently no way to bind the numbering with the section\nnumbers (like Definition 1.1, 1.2 in the first chapter; 2.1, 2.2, ... etc in\nthe second one) - but I have started working on this and I have an idea how to\nimplement it - though it requires some effort.\n\n\nThe syntax for the directive is very similar to\n\n```\n\\begin{theorem}[title]\n    ...\n\\end{theorem}\n```\nthe equivalent usage of theorem directive is:\n\n```\n.. theorem:: title\n\n    ...\n```\n\nenvironment directive\n---------------------\n\nFurthermore, there is an environment directive which allows for more\nsophisticated constructions:\n\n```\n.. environment::\n    :class: ENV_CLASS\n    :name: Definition\n    :html_title: title used by html builder\n    :latex_title: title used by latex builder\n\n\t...\n```\nYou can also use `:title:` which if both `:html_title:` and `:latex_title:`\nare ought to be the same.  This directive will probably be changed in future\nreleases.\n\ntextcolor role\n--------------\n\nYou can also change the color with the `:textcolor:` role:\n\n```\n:textcolor:`\u003ccolor_spec\u003e colored text`\n```\nThe color_spec is an HTML color model, e.g. #ffffff for white, #00ff00 for\ngreen, etc.  The LaTeX builder is using \\textcolor[HTML]{color_spec}{colored\ntext} (with the `#` removed from `color_spec`).  The HTML builder is using\n\n```\n\u003cfont color=\"color_spec\"\u003ecolored text\u003c/font\u003e\n```\nto change the font color.\n\nendpar directive\n----------------\n\nThe ``.. endpar::`` directive will input \u003c/br\u003e into HTML and an empty line\ninto LaTeX source file - which ends a paragraph in LaTeX.\n\n\nalign directive\n---------------\n\nThere is also align directive which aligns the code:\n\n```\n.. align:: center\n\n    Centered text\n\n.. align:: flushleft\n\n    Left aligned text\n\n.. align:: flushright\n\n    Right aligned text\n```\nYou can also use 'left' and 'right' instead of 'flushleft' and 'flushright'.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoot%2Fsphinx_latex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoot%2Fsphinx_latex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoot%2Fsphinx_latex/lists"}