{"action":"created","issue":{"url":"https://api.github.com/repos/rbeezer/mathbook/issues/49","labels_url":"https://api.github.com/repos/rbeezer/mathbook/issues/49/labels{/name}","comments_url":"https://api.github.com/repos/rbeezer/mathbook/issues/49/comments","events_url":"https://api.github.com/repos/rbeezer/mathbook/issues/49/events","html_url":"https://github.com/rbeezer/mathbook/pull/49","id":56927781,"number":49,"title":"Feature/tikz preamble","user":{"login":"Alex-Jordan","id":4732672,"avatar_url":"https://avatars.githubusercontent.com/u/4732672?v=3","gravatar_id":"","url":"https://api.github.com/users/Alex-Jordan","html_url":"https://github.com/Alex-Jordan","followers_url":"https://api.github.com/users/Alex-Jordan/followers","following_url":"https://api.github.com/users/Alex-Jordan/following{/other_user}","gists_url":"https://api.github.com/users/Alex-Jordan/gists{/gist_id}","starred_url":"https://api.github.com/users/Alex-Jordan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Alex-Jordan/subscriptions","organizations_url":"https://api.github.com/users/Alex-Jordan/orgs","repos_url":"https://api.github.com/users/Alex-Jordan/repos","events_url":"https://api.github.com/users/Alex-Jordan/events{/privacy}","received_events_url":"https://api.github.com/users/Alex-Jordan/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-02-07T21:58:38Z","updated_at":"2015-02-08T03:26:26Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/rbeezer/mathbook/pulls/49","html_url":"https://github.com/rbeezer/mathbook/pull/49","diff_url":"https://github.com/rbeezer/mathbook/pull/49.diff","patch_url":"https://github.com/rbeezer/mathbook/pull/49.patch"},"body":"This allows us to put extra packages and other preamble content into the code that goes into a `<tikz>` tag. Without this, everything you would put into a `<tikz>` tag goes into the body of a `standalone` tex document, and the preamble of that tex document is only what is hard coded into `extract-tikz.xsl`.\r\n\r\nThere is an example in `sample-article.xml` using the `forest` package.\r\n\r\nI think this is good, but a side effect of the changes that I made is that no tags within a `<tikz>` tag are recognized (except the new `<tikz-extra-preamble>`). My understanding is that formerly, only text (tex code) content would have been inside a `<tikz>` tag, so this should be backward compatible."},"comment":{"url":"https://api.github.com/repos/rbeezer/mathbook/issues/comments/73395185","html_url":"https://github.com/rbeezer/mathbook/pull/49#issuecomment-73395185","issue_url":"https://api.github.com/repos/rbeezer/mathbook/issues/49","id":73395185,"user":{"login":"rbeezer","id":1881714,"avatar_url":"https://avatars.githubusercontent.com/u/1881714?v=3","gravatar_id":"","url":"https://api.github.com/users/rbeezer","html_url":"https://github.com/rbeezer","followers_url":"https://api.github.com/users/rbeezer/followers","following_url":"https://api.github.com/users/rbeezer/following{/other_user}","gists_url":"https://api.github.com/users/rbeezer/gists{/gist_id}","starred_url":"https://api.github.com/users/rbeezer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rbeezer/subscriptions","organizations_url":"https://api.github.com/users/rbeezer/orgs","repos_url":"https://api.github.com/users/rbeezer/repos","events_url":"https://api.github.com/users/rbeezer/events{/privacy}","received_events_url":"https://api.github.com/users/rbeezer/received_events","type":"User","site_admin":false},"created_at":"2015-02-08T03:26:26Z","updated_at":"2015-02-08T03:26:26Z","body":"This looks good.  How about the following plan?\r\n\r\n* Make attributes for the \"tikz\" element: packages, library, preamble.  The \"packages\" one could be a comma-separated list and MBX would provide the \"\\usepackage{}\" part.  Similarly for \\tikzlibrary{}.  \"preamble\" would require author to provide everything they want to see.\r\n\r\n* Do as you have done with  `xsl/extract-tikz.xsl`.   I'd prefer the content of the \"tikz\" element to be all text or totally subdivided with elements, so the  \"select='.'\" was intentional.  Notice on the latex side, I sanitize the left margin (using poorly-named templates that clean up sage-code but are really much more general-purpose).\r\n\r\n* In the latex conversion add to the preamble something like \r\n```<xsl:for-each select=\"//tikz/@package\">......</xsl:for-each>``` \r\nthat writes out the necessary items to the latex preamble.\r\n\r\n* Likely a long document might use the same packages repeatedly.  I'm assuming latex/tikz are smart enough to not be bothered by redundant includes.  Also, authors will get tired of specifying them repeatedly.  So global \"param\"'s in `xsl/mathbook-common.xsl` would make sense.   The converters can all access these values (from command line, or in a compatibility layer), though I will need to make it possible for the mbx script to pass them through to `xsl/extract-tikz.xsl` as suggested in #16.\r\n\r\nConsider as much of this as you have an appetite for.  At least: locally allowing packages with an attribute, and getting those options into the latex output.  I can do the rest using your work as  a model.\r\n\r\nAre there other libraries I should just include as \"standard\"?\r\n\r\nRob"}}