Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/tikz preamble #49

Closed

Conversation

Alex-Jordan
Copy link
Contributor

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.

There is an example in sample-article.xml using the forest package.

I 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.

@Alex-Jordan
Copy link
Contributor Author

OK, I see the problem now. In the hard copy side, the standalone image file is not used to make the book's pdf. Instead, the tikz code is inserted into the .tex file for the whole book. And that makes my attempt to insert \usepackage{} at this local level a problem.

Why not have the .tex side use the standalone image files too, as the HTML does? If you are outputting HTML anyway, you have already run the mbx script that created both a .pdf and an .svg of the image. Instead of having the tikz code go back into the .tex for the book, the .tex file for the book could just include the .pdf file of the image. It would save compilation time for one thing, but it would also serve my purpose here: to allow special packages at the level of an individual image that needs a special package.

I'll make the adjustments to <tikz> in mathbook-latex.xsl if you don't raise an objection.

@rbeezer
Copy link
Collaborator

rbeezer commented Feb 8, 2015

This looks good. How about the following plan?

  • 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.
  • 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).
  • In the latex conversion add to the preamble something like
    <xsl:for-each select="//tikz/@package">......</xsl:for-each>
    that writes out the necessary items to the latex preamble.
  • 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 Pass in XSL parameters to MBX script #16.

Consider 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.

Are there other libraries I should just include as "standard"?

Rob

@Alex-Jordan
Copy link
Contributor Author

Are there other libraries I should just include as "standard"?

pgfplots is quite useful for 2D and 3D plots. I think of tikz for more
"graphics primitive" things (not to imply tikz is primitive at all). With
pgfplots it's easy to make various Cartesian plots. I believe pgfplots
loads tikz, so loading it would make a tikz call unnecessary.

Another one might be pgfplotstables, which can do things like access data
from a csv file and then do things with that data, both tabular and
graphical.

I have a few more thoughts about this:

  • If I were working on something that had a lot of Cartesian graphs that
    I wanted to have a consistent look, I'd set a whole bunch of pgfplots
    parameters in the preamble. It would seem that we'd want
    xsl/extract-tikz.xsl to see these settings. So it might be a good idea to
    have a place in "hub files" (like say scla.xml) that set all the
    pgfplots and tikz parameters. And then xsl/extract-tikz.xsl would
    call these and put them into the standalone preamble.
  • While you originally had tikz graphics in mind, it seems to me that
    a <tikz> tag can be used to make any standalone LaTeX document. Yes, the
    tikz package is hard coded into xsl/extract-tikz.xsl. But there are
    other graphics engines to consider, like pstricks and xyplot. What
    about a <standalone> tag that could have an attribute that specified the
    basic nature of the image file (tikz, pgfplots, pstricks, etc) and chose
    used different preambles depending? For backwards compatibility, the
    <tikz> tag could be set up to call <standalone> with the tikz option.
    In my personal projects, tikz and pgfplots (and other tikz-based
    packages) are all I would want, but others may find something like this
    useful.

I'll keep working on this and say something on the pull request thread if
I'm at a place for more review.

On Sat, Feb 7, 2015 at 7:26 PM, Rob Beezer notifications@github.com wrote:

This looks good. How about the following plan?

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.

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).

In the latex conversion add to the preamble something like
<xsl:for-each select="//tikz/@Package">....../xsl:for-each
that writes out the necessary items to the latex preamble.

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
#16.

Consider 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.

Are there other libraries I should just include as "standard"?

Rob


Reply to this email directly or view it on GitHub
#49 (comment).

Alex Jordan
Mathematics Instructor
Portland Community College

@Alex-Jordan
Copy link
Contributor Author

OK, I'm ready for a review. There are some things that are not right for sure, and some other things that you may disagree with (and if so, I'm happy to change).

  • Deprecating tikz tag altogether.
  • Introducing image/latex-image as a replacement, which may need a better name (latex-standalone?) latex output is surrounded by braces to trap local settings.
  • Added latex option (counterpart to tikz option) to mbx script, and added extract-latex-image.xsl to convert image/latex-image to pdf, svg, and tex source.
  • Alongside docinfo/macros, added docinfo/latex-image-preamble (again, may need a better name). This is inserted into the main tex output's preamble (currently, right before latex-preamble-late). And it is inserted into each standalone tex file's preamble. My thoughts are that the \usepackage{tikz} and the libraries you had in play are specific to an author's needs, and belong in this new docinfo/latex-image-preamble. For myself, as a user of pgfplots, I would be calling different packages, libraries, and using different settings.
  • Edited sample-article.xml to use image/latex-image instead of tikz. Also added a pgfplots example.

Issues

  • Need to go through and fully deprecate <tikz>. Right now it's only the deprecation warnings you put in for naked <tikz>, and I put one more deprecation warning in mathbook-latex.xsl.
  • Better names? I'd need to go through each of mathbook-latex.xsl, mathbook-html.xsl, extract-latex-image.xsl, and mbx to make changes.
  • You had mentioned attributes for this latex-image tag, like packages and libraries. I don't think it's a good idea anymore to load these things locally at the latex-image tag. For one thing, it's quite possible to get clashes in the big tex output if different latex-images loaded the same packages with different options, or loaded different packages. Just like convenience macros, I'd lean toward requiring the author to list all such packages in the docinfo. Note that for any existing projects, they can keep using the deprecated tikz tag, but if they switch over to latex-image, they would have to put \usepackage{tikz} and those library calls into docinfo/latex-image-preamble`.
  • This still hard codes amsmath and amssymb into the standalone image files. I don't see anything wrong with that, but what if someone wanted more along these non-graphical lines? Other things might get loaded in preamble-early and preamble-late that could be desired in the standalone images.

@rbeezer
Copy link
Collaborator

rbeezer commented Feb 13, 2015

Looking great. Comments, in order of appearance:

  • Deprecating tikz altogether is fine.
  • I like "latex-image" better than "latex-standalone" (a user/author should not need to know what "standalone" means). It would be wordy, but "latex-image-code" is what it really is (parallel to "latex-image-preamble"). I think there may still be a better name.
  • Sounds to me like moving most inclusions to the preamble element makes sense. And you should forget about the "package" and "library" tags. Please document the change somehow for people migrating away from the old style.
  • MathJax basically implements amsmath. I'm hoping folks can get along without more than that. So we should hard code it always in Latex preambles. Of course, if they stick to images, being compatible with MathJax is not an issue.

Looking over commits:

  • Does your "for-each" on text nodes behave well? I have rather elaborate routines to clean-up Sage code while preserving indentation, you could do that here as well.
  • Are all of the SVG image files really different now? (The ones in images/.) Are the changes due to different pachkages, or is it just that they are built on a different architecture? I'd rather just add new images (like your pfgplots examples) if the differences are superficial.
  • "pgfplkots" in description.
  • Nice to see "LaTeX" fixed.
  • I find I am happier (not sure why), when an element is either all "content" or is totally subdivided by other elements. So latex-image/tikz-extra-preamble alongside latex-image/. (ie the commands) makes me want to wrap the commands in "code" or something. Likely an overreaction, and maybe I have something to learn from your code (which looks good). Thoughts? Persuasive arguments?

Not much energy left tonite to actually test this out. Enough guidance for you to continue working on this? Will your merge of my edits behave when I try to pull this onto my repo?

@Alex-Jordan
Copy link
Contributor Author

OK, I've done some more things.

  • <latex-image-code> tag inside <image> tags
  • <tikz> environment should be fully deprecated and give the right warnings if it used. Rather than telling people to put it inside an <image>, I just changed it to say that <latex-image-code> has superceded <tikz>, and also that you should explicitly put the tikz package and any libraries you need into docinfo/latex-image-preamble.
  • What for each are you referring to? I'm not sure the final version of all this has a loop like that, except where a loop arises in the mbx script. In the script, I just copied exactly what was there for the tikz tags.
  • extract-tikz.xsl should eventually become obsolete; added a comment about that.
  • image files just different because of my OS and LaTeX distribution would be my guess. I reverted to the ones from origin/dev.
  • Not sure what you mean about latex-image/tikz-extra-preamble. Right now the architecture is docinfo/latex-image-preamble alongside docinfo/macros. Then there is figure/image/latex-image-code down in the body. If you have a suggestion to do it differently, let me know and I'll happily oblige.

@Alex-Jordan
Copy link
Contributor Author

Perhaps this is related to your comment. As things are now, the latex code is getting initial characters shaved off at each line if there are tab characters at the beginning of lines. This must be the effect of

    <xsl:call-template name="sanitize-sage">
        <xsl:with-param name="raw-sage-code" select="." />
    </xsl:call-template>

What do you recommend to do about this?

@rbeezer
Copy link
Collaborator

rbeezer commented Feb 16, 2015

Yep, for Sage and Python code the indentation is critical. So I suggest never
mixing the two. (I just had this discussion with Chris.)

My editor will "Save with Spaces" and I can tab-away easily while diting, but
they never migrate into the source.

Left margin is set by the first non-whitespace character and then it gets
consistently eaten of the front of each line (and we can never be certain how
big a tab is meant to be).

On 02/15/2015 07:38 PM, Alex Jordan wrote:

Perhaps this is related to your comment. As things are now, the latex code is
getting initial characters shaved off at each line if there are tab characters
at the beginning of lines. This must be the effect of

| <xsl:call-template name="sanitize-sage">
<xsl:with-param name="raw-sage-code" select="." />
/xsl:call-template
|

What do you recommend to do about this?


Reply to this email directly or view it on GitHub
#49 (comment).

@rbeezer
Copy link
Collaborator

rbeezer commented Feb 17, 2015

Dear Alex,

I pulled your branch and looked all through the code. It looks good. About done for the day, so I'll do some actual testing very soon, likely on Wednesday.

Some really minor stuff that I am trying to be picky about:

  • Can you patrol for extraneous whitespace? My "git diff" shows this stuff in bright red. A few single extra blanks at line ends, and some (one?) "blank" line that is really a bunch of spaces.
  • Are you able to squash down the commits into a handful of topical ones, like HTML adjustments, latex adjustments, mbx adjustments, then sample article (and image) last? Or similar? With commit messages that are short and capitalized? I have a procedure for smashing down a big branch like this and then adding back a handful of selected new commits. Ask if interested.
  • Did you rebase onto d757c74 since I last looked at this (that's what I would do). Are you able to pull dev from my github version and rebase your branch onto the new tip? I have my own home-grown ideas on how to manage all this, but don't know if it works well for others or not.

Rob

@Alex-Jordan
Copy link
Contributor Author

I removed two end of line characters from two files that were showing up in the git diff, and removed two tabs from one blank line in the sample article. Do you see more white space issues? If you do, would it be possible to comment on them directly in GitHub where they are?

For the second and third bullets, I can try to learn, but I'm not as adept with git as you might guess. I wasn't aware that you can combine commits in the way you suggest. And I'm not really sure what rebasing is. When you pulled the description tag in, I had already been working here. I fetched origin, then pulled origin/dev into this branch. There was a conflict of some sort that I had to correct for, as the commit logs show. I'm guessing that rebasing is some smarter way to merge this with the mathbook-sagenb.xsl edits?

I'm happy to learn how to do these things. It may take me a few more days though.

@rbeezer
Copy link
Collaborator

rbeezer commented Feb 18, 2015

Dear Alex,

Put this through its paces and it looks good to me. Some whitespace in a
minute, and I will send you some git ideas off-list and we can learn together.

Are there any more touch-ups you plan/want to do?

I'm thinking we might be able to put latex code for commutative diagrams into
one of these? That'd be a great unexpected possibility.

Rob

On 02/16/2015 11:09 PM, Alex Jordan wrote:

I removed two end of line characters from two files that were showing up in the
git diff, and removed two tabs from one blank line in the sample article. Do you
see more white space issues? If you do, would it be possible to comment on them
directly in GitHub where they are?

For the second and third bullets, I can try to learn, but I'm not as adept with
git as you might guess. I wasn't aware that you can combine commits in the way
you suggest. And I'm not really sure what rebasing is. When you pulled the
description tag in, I had already been working here. I fetched origin, then
pulled origin/dev into this branch. There was a conflict of some sort that I had
to correct for, as the commit logs show. I'm guessing that rebasing is some
smarter way to merge this with the mathbook-sagenb.xsl edits?

I'm happy to learn how to do these things. It may take me a few more days though.


Reply to this email directly or view it on GitHub
#49 (comment).

@rbeezer
Copy link
Collaborator

rbeezer commented Feb 18, 2015

Dear Alex,

Whitespace at the end of following lines. Sorry - I didn't bother to figure out
how to mark these in GitHub and figued this might work just as well for you
anyway. I think all are at the end of the line.

sample-article.xml

  • Inserted in the preamble to each standalone latex-based image for HMTL SVG
    output.
  • \pgfplotsset{axis x line = middle,
  • \addplot[

extract-latex-image.xsl (highly probable these are my fault)

mathbook-latex.xsl

  • <xsl:if test="not(parent::image)">

Rob

On 02/16/2015 11:09 PM, Alex Jordan wrote:

I removed two end of line characters from two files that were showing up in the
git diff, and removed two tabs from one blank line in the sample article. Do you
see more white space issues? If you do, would it be possible to comment on them
directly in GitHub where they are?

For the second and third bullets, I can try to learn, but I'm not as adept with
git as you might guess. I wasn't aware that you can combine commits in the way
you suggest. And I'm not really sure what rebasing is. When you pulled the
description tag in, I had already been working here. I fetched origin, then
pulled origin/dev into this branch. There was a conflict of some sort that I had
to correct for, as the commit logs show. I'm guessing that rebasing is some
smarter way to merge this with the mathbook-sagenb.xsl edits?

I'm happy to learn how to do these things. It may take me a few more days though.


Reply to this email directly or view it on GitHub
#49 (comment).

@Alex-Jordan
Copy link
Contributor Author

I addressed those white spaces. Also the corresponding ones in
extract-tikz.xsl, which was what I copied to make
extract-latex-image.xsl.

I don't have any ideas on more for this feature, except I do wonder if the
sage scrubbing is appropriate for latex code. If an author doesn't indent
their code well, the front bits of each line will get chopped. If they are
producing xml->tex->pdf, they'll probably see the issue in their tex file.
But if they are producing xml->html, and use the mbx script to make images,
the script will just hang when it gets to where it should be converting
tex->pdf. I think I just have it there because it was their for <tikz>.
Thoughts?

latex-image-code should be able to handle commutative diagrams. Just
throw the relevant packages and settings into
docinfo/latex-image-preamble, and then you can make a commutative diagram
inside <latex-image-code>. You could add one to the sample document. I
Googled "LaTeX commutative diagram", and it looks like there are many
options. I though xypic was the dominant package for this, but that may be
old news. Looks like a lot of people like tikz-cd.

I'll look into combining commits.

On Tue, Feb 17, 2015 at 8:55 PM, Rob Beezer notifications@github.com
wrote:

Dear Alex,

Whitespace at the end of following lines. Sorry - I didn't bother to
figure out
how to mark these in GitHub and figued this might work just as well for
you
anyway. I think all are at the end of the line.

sample-article.xml

  • Inserted in the preamble to each standalone latex-based image for HMTL
    SVG
    output.
  • \pgfplotsset{axis x line = middle,
  • \addplot[

extract-latex-image.xsl (highly probable these are my fault)

mathbook-latex.xsl

  • <xsl:if test="not(parent::image)">

Rob

On 02/16/2015 11:09 PM, Alex Jordan wrote:

I removed two end of line characters from two files that were showing up
in the
git diff, and removed two tabs from one blank line in the sample
article. Do you
see more white space issues? If you do, would it be possible to comment
on them
directly in GitHub where they are?

For the second and third bullets, I can try to learn, but I'm not as
adept with
git as you might guess. I wasn't aware that you can combine commits in
the way
you suggest. And I'm not really sure what rebasing is. When you pulled
the
description tag in, I had already been working here. I fetched origin,
then
pulled origin/dev into this branch. There was a conflict of some sort
that I had
to correct for, as the commit logs show. I'm guessing that rebasing is
some
smarter way to merge this with the mathbook-sagenb.xsl edits?

I'm happy to learn how to do these things. It may take me a few more
days though.


Reply to this email directly or view it on GitHub
#49 (comment).


Reply to this email directly or view it on GitHub
#49 (comment).

Alex Jordan
Mathematics Instructor
Portland Community College

…nstead of around latex-image; removed errant deprecation comment
…g tikz toward latex-image-code in mathbook-html; changed names in mbx script and extract-latex-image to be consistent; latex-image is the parameter to pass to mbx; enhanced tikz deprecation warnings to tell people to put tikz package and any needed libraries into tikz-image-preamble; cleanup
@Alex-Jordan
Copy link
Contributor Author

I squashed commits from 18 down to 9. It looks to me like further squashing could be done, but it would involve re-ordering the commits, and I'm worried that would cause conflicts I'd need to resolve. I found this helpful: http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html

@rbeezer
Copy link
Collaborator

rbeezer commented Feb 19, 2015

Dear Alex,

Thanks for the whitespace cleanup and for cleaning up my (propogated) messes.

I learned something. When I pulled your squashed branch, I got a big mess on my end. ;-) Not at all your fault, it was an experiment and that was a high-probability outcome. I trashed the mess and pulled as if it was the first time. All good. But I need to learn/think about some things relative to collaboration.

Right - you do not really want to reorder unless you are 100% sure about the lack of dependencies. But I've done it. ;-) Did you consider doing a massive "fixup" into one commit and then editing it back into smaller pieces? While there is semi-rapid development and little documentation, I want the log/history to be especially useful to newcomers.

I would really like to have this contribution be commits like (at most)

  • latex upright - isolated
  • HTML changes
  • LaTeX changes
  • mbx changes
  • sample article + new pgfplot graphics files

and I might even consolidate the three middle ones if it was me.

It looks like you "squash"'ed rather than "fixup"'ed, maybe? The commit messages look like a consolidation.

I could do the roll-up and I think preserve/name you as author so the record is straight. Just let me know.

Rob

@rbeezer
Copy link
Collaborator

rbeezer commented Feb 19, 2015

On 02/17/2015 11:42 PM, Alex Jordan wrote:

I don't have any ideas on more for this feature, except I do wonder if the
sage scrubbing is appropriate for latex code. If an author doesn't indent
their code well, the front bits of each line will get chopped. If they are
producing xml->tex->pdf, they'll probably see the issue in their tex file.
But if they are producing xml->html, and use the mbx script to make images,
the script will just hang when it gets to where it should be converting
tex->pdf. I think I just have it there because it was their for <tikz>.
Thoughts?

I'd really, really like to banish tabs from the source. An author sees them as
2 spaces, 4 spaces, 8 spaces depending on their settings. What should we do
with that?

One of my (many) goals is really clean (human-readable?) source. Especially
since the latex output is your data-liberation guarantee. You can always take
your latex and go home. So I want folks to be able to put source code
way-indented, but also have it flush-left in latex and html output. The name of
the template needs to change (and will). Perhaps I need better error-handling
on the mbx script, catch some error codes and suggest tabs could be to blame.

latex-image-code should be able to handle commutative diagrams. Just
throw the relevant packages and settings into
docinfo/latex-image-preamble, and then you can make a commutative diagram
inside <latex-image-code>. You could add one to the sample document. I
Googled "LaTeX commutative diagram", and it looks like there are many
options. I though xypic was the dominant package for this, but that may be
old news. Looks like a lot of people like tikz-cd.

David Farmer has some of these from his own experiments. I can maybe get some
good examples from him for the sample article, once your stuff goes in.

@davidfarmer
Copy link
Contributor

For commutative diagrams, among existing papers the most popular
package is xypic. I can provide examples.

Mathjax dos not know about xypic. It supposedly knows a simpler
AMS package that can only draw rectangular diagrams, but I have had
some trouble with that. For SL2X I make an image of the diagram
to put in the html version.

On Thu, 19 Feb 2015, Rob Beezer wrote:

On 02/17/2015 11:42 PM, Alex Jordan wrote:

I don't have any ideas on more for this feature, except I do wonder if the
sage scrubbing is appropriate for latex code. If an author doesn't indent
their code well, the front bits of each line will get chopped. If they are
producing xml->tex->pdf, they'll probably see the issue in their tex file.
But if they are producing xml->html, and use the mbx script to make images,
the script will just hang when it gets to where it should be converting
tex->pdf. I think I just have it there because it was their for <tikz>.
Thoughts?

I'd really, really like to banish tabs from the source. An author sees them as
2 spaces, 4 spaces, 8 spaces depending on their settings. What should we do
with that?

One of my (many) goals is really clean (human-readable?) source. Especially
since the latex output is your data-liberation guarantee. You can always take
your latex and go home. So I want folks to be able to put source code
way-indented, but also have it flush-left in latex and html output. The name of
the template needs to change (and will). Perhaps I need better error-handling
on the mbx script, catch some error codes and suggest tabs could be to blame.

latex-image-code should be able to handle commutative diagrams. Just
throw the relevant packages and settings into
docinfo/latex-image-preamble, and then you can make a commutative diagram
inside <latex-image-code>. You could add one to the sample document. I
Googled "LaTeX commutative diagram", and it looks like there are many
options. I though xypic was the dominant package for this, but that may be
old news. Looks like a lot of people like tikz-cd.

David Farmer has some of these from his own experiments. I can maybe get some
good examples from him for the sample article, once your stuff goes in.


Reply to this email directly or view it on GitHub.[AAM6LPAibbriN8K1zMiUiO6A6WrKp1iTks5nthNSgaJpZM4DdRbo.gif]

@rbeezer
Copy link
Collaborator

rbeezer commented Feb 19, 2015

Thanks, David. I'll ping you after we get Alex's changes in.

This should become a relative no-brainer for an author (modulo xypic), given
Alex's work, and then Chris' "sidebyside" will give even more flexibility about
how to display these.

Rob

On 02/19/2015 09:46 AM, davidfarmer wrote:

For commutative diagrams, among existing papers the most popular
package is xypic. I can provide examples.

Mathjax dos not know about xypic. It supposedly knows a simpler
AMS package that can only draw rectangular diagrams, but I have had
some trouble with that. For SL2X I make an image of the diagram
to put in the html version.

On Thu, 19 Feb 2015, Rob Beezer wrote:

On 02/17/2015 11:42 PM, Alex Jordan wrote:

I don't have any ideas on more for this feature, except I do wonder if the
sage scrubbing is appropriate for latex code. If an author doesn't indent
their code well, the front bits of each line will get chopped. If they are
producing xml->tex->pdf, they'll probably see the issue in their tex file.
But if they are producing xml->html, and use the mbx script to make images,
the script will just hang when it gets to where it should be converting
tex->pdf. I think I just have it there because it was their for <tikz>.
Thoughts?

I'd really, really like to banish tabs from the source. An author sees them as
2 spaces, 4 spaces, 8 spaces depending on their settings. What should we do
with that?

One of my (many) goals is really clean (human-readable?) source. Especially
since the latex output is your data-liberation guarantee. You can always take
your latex and go home. So I want folks to be able to put source code
way-indented, but also have it flush-left in latex and html output. The name of
the template needs to change (and will). Perhaps I need better error-handling
on the mbx script, catch some error codes and suggest tabs could be to blame.

latex-image-code should be able to handle commutative diagrams. Just
throw the relevant packages and settings into
docinfo/latex-image-preamble, and then you can make a commutative diagram
inside <latex-image-code>. You could add one to the sample document. I
Googled "LaTeX commutative diagram", and it looks like there are many
options. I though xypic was the dominant package for this, but that may be
old news. Looks like a lot of people like tikz-cd.

David Farmer has some of these from his own experiments. I can maybe get some
good examples from him for the sample article, once your stuff goes in.


Reply to this email directly or view it on
GitHub.[AAM6LPAibbriN8K1zMiUiO6A6WrKp1iTks5nthNSgaJpZM4DdRbo.gif]


Reply to this email directly or view it on GitHub
#49 (comment).

@cmhughes
Copy link
Contributor

Slightly off topic, but perhaps not?....

Rob, if you like clean source code, have you seen latexindent? (
https://www.ctan.org/pkg/latexindent). It's part of texlive and MiKTeX.
Disclaimer: I'm the author :)

Sorry to interrupt your conversation--must get back to putting things side
by side now ;)

On Thu, Feb 19, 2015 at 6:31 PM, Rob Beezer notifications@github.com
wrote:

Thanks, David. I'll ping you after we get Alex's changes in.

This should become a relative no-brainer for an author (modulo xypic),
given
Alex's work, and then Chris' "sidebyside" will give even more flexibility
about
how to display these.

Rob

On 02/19/2015 09:46 AM, davidfarmer wrote:

For commutative diagrams, among existing papers the most popular
package is xypic. I can provide examples.

Mathjax dos not know about xypic. It supposedly knows a simpler
AMS package that can only draw rectangular diagrams, but I have had
some trouble with that. For SL2X I make an image of the diagram
to put in the html version.

On Thu, 19 Feb 2015, Rob Beezer wrote:

On 02/17/2015 11:42 PM, Alex Jordan wrote:

I don't have any ideas on more for this feature, except I do wonder
if the
sage scrubbing is appropriate for latex code. If an author doesn't
indent
their code well, the front bits of each line will get chopped. If
they are
producing xml->tex->pdf, they'll probably see the issue in their tex
file.
But if they are producing xml->html, and use the mbx script to make
images,
the script will just hang when it gets to where it should be
converting
tex->pdf. I think I just have it there because it was their for
<tikz>.
Thoughts?

I'd really, really like to banish tabs from the source. An author sees
them as
2 spaces, 4 spaces, 8 spaces depending on their settings. What should
we do
with that?

One of my (many) goals is really clean (human-readable?) source.
Especially
since the latex output is your data-liberation guarantee. You can
always take
your latex and go home. So I want folks to be able to put source code
way-indented, but also have it flush-left in latex and html output.
The name of
the template needs to change (and will). Perhaps I need better
error-handling
on the mbx script, catch some error codes and suggest tabs could be to
blame.

latex-image-code should be able to handle commutative diagrams.
Just
throw the relevant packages and settings into
docinfo/latex-image-preamble, and then you can make a commutative
diagram
inside <latex-image-code>. You could add one to the sample
document. I
Googled "LaTeX commutative diagram", and it looks like there are many
options. I though xypic was the dominant package for this, but that
may be
old news. Looks like a lot of people like tikz-cd.

David Farmer has some of these from his own experiments. I can maybe
get some
good examples from him for the sample article, once your stuff goes in.


Reply to this email directly or view it on
GitHub.[AAM6LPAibbriN8K1zMiUiO6A6WrKp1iTks5nthNSgaJpZM4DdRbo.gif]


Reply to this email directly or view it on GitHub
#49 (comment).


Reply to this email directly or view it on GitHub
#49 (comment).

@rbeezer
Copy link
Collaborator

rbeezer commented Feb 20, 2015

Very nice! I did not know about that. (I knew you had some chops.)

I made an issue to add this step to the mbx script, so it does not get lost.
I'll tinker with it soon.

Thanks!

On 02/19/2015 02:16 PM, cmhughes wrote:

Slightly off topic, but perhaps not?....

Rob, if you like clean source code, have you seen latexindent? (
https://www.ctan.org/pkg/latexindent). It's part of texlive and MiKTeX.
Disclaimer: I'm the author :)

Sorry to interrupt your conversation--must get back to putting things side
by side now ;)

On Thu, Feb 19, 2015 at 6:31 PM, Rob Beezer notifications@github.com
wrote:

Thanks, David. I'll ping you after we get Alex's changes in.

This should become a relative no-brainer for an author (modulo xypic),
given
Alex's work, and then Chris' "sidebyside" will give even more flexibility
about
how to display these.

Rob

On 02/19/2015 09:46 AM, davidfarmer wrote:

For commutative diagrams, among existing papers the most popular
package is xypic. I can provide examples.

Mathjax dos not know about xypic. It supposedly knows a simpler
AMS package that can only draw rectangular diagrams, but I have had
some trouble with that. For SL2X I make an image of the diagram
to put in the html version.

On Thu, 19 Feb 2015, Rob Beezer wrote:

On 02/17/2015 11:42 PM, Alex Jordan wrote:

I don't have any ideas on more for this feature, except I do wonder
if the
sage scrubbing is appropriate for latex code. If an author doesn't
indent
their code well, the front bits of each line will get chopped. If
they are
producing xml->tex->pdf, they'll probably see the issue in their tex
file.
But if they are producing xml->html, and use the mbx script to make
images,
the script will just hang when it gets to where it should be
converting
tex->pdf. I think I just have it there because it was their for
<tikz>.
Thoughts?

I'd really, really like to banish tabs from the source. An author sees
them as
2 spaces, 4 spaces, 8 spaces depending on their settings. What should
we do
with that?

One of my (many) goals is really clean (human-readable?) source.
Especially
since the latex output is your data-liberation guarantee. You can
always take
your latex and go home. So I want folks to be able to put source code
way-indented, but also have it flush-left in latex and html output.
The name of
the template needs to change (and will). Perhaps I need better
error-handling
on the mbx script, catch some error codes and suggest tabs could be to
blame.

latex-image-code should be able to handle commutative diagrams.
Just
throw the relevant packages and settings into
docinfo/latex-image-preamble, and then you can make a commutative
diagram
inside <latex-image-code>. You could add one to the sample
document. I
Googled "LaTeX commutative diagram", and it looks like there are many
options. I though xypic was the dominant package for this, but that
may be
old news. Looks like a lot of people like tikz-cd.

David Farmer has some of these from his own experiments. I can maybe
get some
good examples from him for the sample article, once your stuff goes in.


Reply to this email directly or view it on
GitHub.[AAM6LPAibbriN8K1zMiUiO6A6WrKp1iTks5nthNSgaJpZM4DdRbo.gif]


Reply to this email directly or view it on GitHub
#49 (comment).


Reply to this email directly or view it on GitHub
#49 (comment).


Reply to this email directly or view it on GitHub
#49 (comment).

@Alex-Jordan
Copy link
Contributor Author

I created a new branch for all this, and used git diff to bring in the new elements in a controlled manner. I'm sure there was a proper git solution, but this only took me 30 minutes. If #55 checks out, then this pull request can be closed.

@Alex-Jordan
Copy link
Contributor Author

Closing this. #55 has been merged.

rbeezer pushed a commit that referenced this pull request Nov 1, 2023
Javascript to support search
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants