{"action":"created","issue":{"url":"https://api.github.com/repos/sphinx-doc/sphinx/issues/2535","repository_url":"https://api.github.com/repos/sphinx-doc/sphinx","labels_url":"https://api.github.com/repos/sphinx-doc/sphinx/issues/2535/labels{/name}","comments_url":"https://api.github.com/repos/sphinx-doc/sphinx/issues/2535/comments","events_url":"https://api.github.com/repos/sphinx-doc/sphinx/issues/2535/events","html_url":"https://github.com/sphinx-doc/sphinx/issues/2535","id":153961028,"number":2535,"title":"weird alignment","user":{"login":"andreacassioli","id":6704112,"avatar_url":"https://avatars.githubusercontent.com/u/6704112?v=3","gravatar_id":"","url":"https://api.github.com/users/andreacassioli","html_url":"https://github.com/andreacassioli","followers_url":"https://api.github.com/users/andreacassioli/followers","following_url":"https://api.github.com/users/andreacassioli/following{/other_user}","gists_url":"https://api.github.com/users/andreacassioli/gists{/gist_id}","starred_url":"https://api.github.com/users/andreacassioli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andreacassioli/subscriptions","organizations_url":"https://api.github.com/users/andreacassioli/orgs","repos_url":"https://api.github.com/users/andreacassioli/repos","events_url":"https://api.github.com/users/andreacassioli/events{/privacy}","received_events_url":"https://api.github.com/users/andreacassioli/received_events","type":"User","site_admin":false},"labels":[{"id":162416101,"url":"https://api.github.com/repos/sphinx-doc/sphinx/labels/latex","name":"latex","color":"FFFFFF","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":9,"created_at":"2016-05-10T09:22:57Z","updated_at":"2016-11-18T23:02:26Z","closed_at":null,"body":"I have a code like this:\n\n```\n.. rubric:: See also\n\n:ref:`iparam.bi_ignore_max_iter`, :ref:`iparam.bi_ignore_num_error`, :ref:`iparam.bi_max_iterations`, :ref:`iparam.bi_clean_optimizer`\n```\n\nAll ref point to sections, whose titles are uppercase names (fairly long indeed).\n\nI generate tex for it, which is\n\n```\n\\paragraph{See also}\n\n{\\hyperref[iparam_bi_ignore_max_iter:iparam\\string-bi\\string-ignore\\string-max\\string-iter]{\\crossref{MSK\\_IPAR\\_BI\\_IGNORE\\_MAX\\_ITER}}}, {\\hyperref[iparam_bi_ignore_num_error:iparam\\string-bi\\string-ignore\\string-num\\\\\nstring-error]{\\crossref{MSK\\_IPAR\\_BI\\_IGNORE\\_NUM\\_ERROR}}}, {\\hyperref[iparam_bi_max_iterations:iparam\\string-bi\\string-max\\string-iterations]{\\crossref{MSK\\_IPAR\\_BI\\_MAX\\_ITERATIONS}}}, {\\hyperref[iparam_bi_clean_op\\\ntimizer:iparam\\string-bi\\string-clean\\string-optimizer]{\\crossref{MSK\\_IPAR\\_BI\\_CLEAN\\_OPTIMIZER}}}\n```\n\nStrangely the final output shows me padded test as shown below\n\n![screenshot from 2016-05-10 11 22 08](https://cloud.githubusercontent.com/assets/6704112/15141677/8079566a-16a1-11e6-879f-6dd1757da3d7.png)\n\nIs it intended? That looks ugly!\n"},"comment":{"url":"https://api.github.com/repos/sphinx-doc/sphinx/issues/comments/261664881","html_url":"https://github.com/sphinx-doc/sphinx/issues/2535#issuecomment-261664881","issue_url":"https://api.github.com/repos/sphinx-doc/sphinx/issues/2535","id":261664881,"user":{"login":"jfbu","id":2589111,"avatar_url":"https://avatars.githubusercontent.com/u/2589111?v=3","gravatar_id":"","url":"https://api.github.com/users/jfbu","html_url":"https://github.com/jfbu","followers_url":"https://api.github.com/users/jfbu/followers","following_url":"https://api.github.com/users/jfbu/following{/other_user}","gists_url":"https://api.github.com/users/jfbu/gists{/gist_id}","starred_url":"https://api.github.com/users/jfbu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jfbu/subscriptions","organizations_url":"https://api.github.com/users/jfbu/orgs","repos_url":"https://api.github.com/users/jfbu/repos","events_url":"https://api.github.com/users/jfbu/events{/privacy}","received_events_url":"https://api.github.com/users/jfbu/received_events","type":"User","site_admin":false},"created_at":"2016-11-18T23:02:26Z","updated_at":"2016-11-18T23:02:26Z","body":"Thus, this has more to do with TeX layout that is has to do with Sphinx. Have you tried above advice, to use ``'preamble'`` key like this:\r\n\r\n```python\r\nlatex_elements = {\r\n    'preamble' :\r\n\"\"\"\\\\makeatletter\r\n\\\\protected\\\\def\\\\_{\\\\ifmmode\\\\nfss@text{\\\\textunderscore}\\\\else\r\n                    \\\\textunderscore\\\\allowbreak\\\\fi}\r\n\\\\makeatother\"\"\",\r\n}\r\n```\r\n\r\nI replaced  ``\\DeclareRobustCommand`` as in https://github.com/sphinx-doc/sphinx/issues/2535#issuecomment-222625445 by ``\\protected\\def`` which is more modern syntax. The definition itself differs from the standard LaTeX one for ``\\_`` only by addition of an ``\\allowbreak``. With:\r\n\r\n```rst\r\nWelcome to a's documentation!\r\n=============================\r\n\r\nLONG_LONG_LONG_LONG_SECTION_NAME\r\nLONG_LONG_LONG_LONG_SECTION_NAME\r\nLONG_LONG_LONG_LONG_SECTION_NAME\r\nLONG_LONG_LONG_LONG_SECTION_NAME\r\nLONG_LONG_LONG_LONG_SECTION_NAME\r\nLONG_LONG_LONG_LONG_SECTION_NAME\r\n\r\n.. _label:\r\n\r\nLONG_LONG_LONG_LONG_SECTION_NAME\r\n--------------------------------\r\n\r\n:ref:`label` :ref:`label` :ref:`label` :ref:`label` :ref:`label` :ref:`label`\r\n\r\n```\r\n\r\nthis gives in particular\r\n\r\n![capture d ecran 2016-11-19 a 00 00 26](https://cloud.githubusercontent.com/assets/2589111/20449710/562cedf4-adeb-11e6-93fd-589fbc3468a9.png)\r\n\r\nCan we close the issue ?\r\n\r\n\r\n"}}
{"actor":{"display_login":"jfbu"}}