PreTeXtBook / pretext

PreTeXt: an authoring and publishing system for scholarly documents
https://pretextbook.org
Other
254 stars 203 forks source link

QED symbol in HTML and LaTeX at end of definitions and examples #320

Closed jasonu closed 5 years ago

jasonu commented 7 years ago

Temporarily add the standard end of proof symbol (either an open box or a closed box) to the end of definitions and examples until a more permanent scheme is designed. Change unknowlized HTML output as well as LaTeX output.

Discussion here: https://groups.google.com/d/msg/mathbook-xml-support/mEXh8JDk5J8/R9zWJLJDAwAJ

davidfarmer commented 7 years ago

More than once I have seen:

open box at end of example

open diamond at end of definition.

On Mon, 20 Jun 2016, Jason Underdown wrote:

Temporarily add the standard end of proof symbol (either an open box or a closed box) to the end of definitions and examples until a more permanent scheme is designed. Change unknowlized HTML output as well as LaTeX output.

Discussion here: https://groups.google.com/d/msg/mathbook-xml-support/mEXh8JDk5J8/R9zWJLJDAwAJ

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.[AAM6LAvtBjayeyelLyJvMyV4L-rUF4kNks5qNwungaJpZM4I6Kze.gif]

rbeezer commented 6 years ago

Suggestions, such as David's above, are welcome. They should be relatively straightforward symbols to get in LaTeX, no bizzare packages necessary. Perhaps some of these can be accomplished in other ways? Is a definition clear enough with trailing vertical space, or is a symbol necessary?

rbeezer commented 6 years ago

This should now be just a LaTeX item, since we are visually maring extent in HTML output regularly. Though some outputs, like EPUB may need markers if styling is inconsistent, or unavailable.

mattboelkins commented 6 years ago

Just writing to express my interest in having this feature added. I don't have a strong preference for what, as I have embraced the "leave the aesthetics to others" maxim.

sepvar commented 6 years ago

Adding my two cents... I am (at this point) indifferent to different endings to different -like environments; but I would like some sort of delimiter indicating the end of the environment. Until we decide on a format, perhaps we can add some sort of horizontal line?

I have decided to sed my tex file with s/\\end{remark}/\\hspace*{\\fill} \\rule[-5pt]{1pt}{10pt}\\hspace{-2.5in}\\rule[-5pt]{2.5in}{1pt}\n\\end{remark}/g

(I am hoping that will be ugly enough to prompt people to pick something.)

davidfarmer commented 6 years ago

Dear Joe,

The lines along the left edge and bottom left corner is called (by me, anyway) "Greg's L", because I copied the idea from APEX Calculus. APEX has it on examples, but I decided to put it on many other things in the HTML.

One option is for you to look at the LaTeX source of APEX and see how Greg did it. (I have not looked: it is possible that the APEX implementation is not adaptable to PTX LaTeX.) Another thing to look at is the thmbox package.

I presume you need something soon, because you are actively using your book. So look in the documentation for how to add custom LaTeX code. Or look at what Oscar Levin does

https://github.com/oscarlevin/discrete-book

Once you figure this out, then a great thing you could do is to help us make progress on offering different layout styles in the PDF. That is, the styling you apply to those *-like environments may not become the PTX default, but there will be a way to easily choose that option when compiling the LaTeX from PTX.

Regards,

David

On Sat, 30 Sep 2017, Joe Christensen wrote:

Adding my two cents... I am (at this point) indifferent to different endings to different -like environments; but I would like some sort of delimiter indicating the end of the environment. Until we decide on a format, perhaps we can add a short (centered?) horizontal line? \centering{\rule{1in}{.02in}} (I am hoping that will be ugly enough to prompt people to pick something.)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.[AAM6LHdjtQ1JfjeYHfilsLYOJ1F3Hc-dks5snksygaJpZM4I6Kze.gif]

sepvar commented 6 years ago

Hello, David.

This is, in principle, very helpful and relevant to what I am asking for. In the style of good news / bad news, I have happy reaction / frustrated reaction:

Happy: Greg's L" from APEX Calculus (and your HTML version) is what inspired my comment.
Frustrated: APEX source is not available with an obvious link and before I ask Greg, I was hoping for something I could investigate myself. Happy: Your suggestion for thmbox, which I found on CTAN, looks promising and I added the thmbox package and I am able to implement what it has. I can also play with the source. Thank you.
Frustrated: thmbox defines example, conflicting with PreTeXt's example. I am trying modifications to the thmbox package as well as trying to lift only the minimal pieces that allow it to work... with moderate success. This is beyond my current working knowledge. Happy: I looked at Oscar's book, which has interesting displays. It helped me find the relevant code in the LaTeX output. Frustrated: Those modifications would require a post-production modification, which I guess is what you mean by "figure it out, then..." Again, the details are at the edge of my current working knowledge. Happy: Opportunity to learn something new!

Frustration: I am having trouble finding "how to add custom LaTeX code" in the documentation.

If you can point me to "add custom LaTeX", I will play with this more.

Aside: I am not actively using my book. I am trying to settle a few layout issues so that they are not so distracting as I fill in content.

davidfarmer commented 6 years ago

The APEX Calculus source is here:

https://github.com/APEXCalculus/APEXCalculus_Source

I looked at it. It is complicated. Probably more complicated that thmbox (but I have not looked at that).

For LaTeX customization, you probably want to use one of latex.preamble.early or latex.preamble.late . Here is a starting point:

http://mathbook.pugetsound.edu/doc/author-guide/html/processing-thin-xsl.html (or maybe you want the previous section)

Once you understand what to do, please suggest how the documentation could have helped you find it.

On Mon, 2 Oct 2017, Joe Christensen wrote:

Hello, David.

This is, in principle, very helpful and relevant to what I am asking for. In the style of good news / bad news, I have happy reaction / frustrated reaction:

Happy: Greg's L" from APEX Calculus (and your HTML version) is what inspired my comment. Frustrated: APEX source is not available with an obvious link and before I ask Greg, I was hoping for something I could investigate myself. Happy: Your suggestion for thmbox, which I found on CTAN, looks promising and I added the thmbox package and I am able to implement what it has. I can also play with the source. Thank you. Frustrated: thmbox defines example, conflicting with PreTeXt's example. I am trying modifications to the thmbox package as well as trying to lift only the minimal pieces that allow it to work... with moderate success. This is beyond my current working knowledge. Happy: I looked at Oscar's book, which has interesting displays. It helped me find the relevant code in the LaTeX output. Frustrated: Those modifications would require a post-production modification, which I guess is what you mean by "figure it out, then..." Again, the details are at the edge of my current working knowledge. Happy: Opportunity to learn something new!

Frustration: I am having trouble finding "how to add custom LaTeX code" in the documentation.

If you can point me to "add custom LaTeX", I will play with this more.

Aside: I am not actively using my book. I am trying to settle a few layout issues so that they are not so distracting as I fill in content.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.[AAM6LMDJwyAzOqQbQ1gjOpq_wPYmZ3B0ks5soPCUgaJpZM4I6Kze.gif]

sepvar commented 6 years ago

Now that you point it out, it is obvious. This was my confusion:

[Aside: That I see my students do this is why I am trying to write Connected Physics, to help students recognize what they actually know but don't recognize as familiar or knowable.]

Differences that might have helped me:

Viewing in hindsight, I don't know if these would have actually helped, but it feels like the place I got caught.

sepvar commented 6 years ago

APEX is more complicated than thmbox, but I think figuring out one of them will make the other understandable.

I will try to keep this idea in the back of my mind and revisit it in the summer after classes end.

rbeezer commented 6 years ago

Thanks for the section-title suggestions, Joe. These "I just got started" suggestions are very helpful for those of us who have been up to our necks in this stuff for years! ;-)

rbeezer commented 6 years ago

On 10/02/2017 10:09 AM, Joe Christensen wrote:

I will try to keep this idea in the back of my mind and revisit it in the summer after classes end.

Winter Break! ;-)

sepvar commented 6 years ago

David: This is what I figured out for now.

It seems that in the tex file, the information is sorted as follows: xml "rename" xml "latex-image-preamble" xsl "latex.preamble.late" xml "latex-preamble" xml "macros"

Since the thmbox package redefines the amsthm \newtheorem and PTX seems to use that, there is a conflict with the example environment, but I can fix it by repeating \newtheorem{example}[theorem]{Example} in the macro section, which necessarily turns it into a thmbox format.

Any environment you want to have be in the thmbox style, must be defined after including the thmbox package. So everything you define in PTX is safe (except example, which gets changed in the inclusion), including the rename environments. But I have to redo the \newtheorem command for the environments that I used rename for if I also want them in the thmbox style.

If I use latex-image-preamble to include thmbox, then I can (probably, but I didn't test it) use the thin XSL to make use \newtheorem to use the thmbox style, but if I use latex-preamble to include thmbox, then I have to use the macro section to have \newtheorem change to the thmbox style. To be safe, I am only doing it in the macros section.

So, I put % make use of thmbox package \newtheorem[S]{proposition}[theorem]{Connection} \newtheorem[S]{insight}[theorem]{Insight} \newtheorem[M]{remark}[theorem]{Clarification} \newtheorem[L]{convention}[theorem]{Convention} \newtheorem[L]{example}[theorem]{Example} \newtheorem[L]{exercise}[theorem]{Exercise} \newtheorem[L]{heuristic}[theorem]{Translation} \newtheorem[L]{investigation}[theorem]{Investigation} \newtheorem[L]{exploration}[theorem]{Exploration} in my macro section and

                <package>thmbox</package>

in my latex-preamble. I am attaching my pdf, which I have not yet uploaded to github nor to the web server. You can see the effect starting at page 35. Connected.pdf

davidfarmer commented 6 years ago

The current setup certainly makes it convoluted to change the style when it involves using a new package.

I don't know what is the "right" way to make a new style. If this is working well enough for your purposes, then I suggest you just think of it as a temporary hack. Later, with the help of others, we can figure out the best way to do it, and how to make it available to other people.

Something I continue to be interested in, is narrowing the text and having a wide margin. Then the touchstones and other asides can go in into the margin, as can other things (see APEX Calculus for many examples).

On Mon, 2 Oct 2017, Joe Christensen wrote:

David: This is what I figured out for now.

It seems that in the tex file, the information is sorted as follows: xml "rename" xml "latex-image-preamble" xsl "latex.preamble.late" xml "latex-preamble" xml "macros"

Since the thmbox package redefines the amsthm \newtheorem and PTX seems to use that, there is a conflict with the example environment, but I can fix it by repeating \newtheorem{example}[theorem]{Example} in the macro section, which necessarily turns it into a thmbox format.

Any environment you want to have be in the thmbox style, must be defined after including the thmbox package. So everything you define in PTX is safe (except example, which gets changed in the inclusion), including the rename environments. But I have to redo the \newtheorem command for the environments that I used rename for if I also want them in the thmbox style.

If I use latex-image-preamble to include thmbox, then I can (probably, but I didn't test it) use the thin XSL to make use \newtheorem to use the thmbox style, but if I use latex-preamble to include thmbox, then I have to use the macro section to have \newtheorem change to the thmbox style. To be safe, I am only doing it in the macros section.

So, I put % make use of thmbox package \newtheorem[S]{proposition}[theorem]{Connection} \newtheorem[S]{insight}[theorem]{Insight} \newtheorem[M]{remark}[theorem]{Clarification} \newtheorem[L]{convention}[theorem]{Convention} \newtheorem[L]{example}[theorem]{Example} \newtheorem[L]{exercise}[theorem]{Exercise} \newtheorem[L]{heuristic}[theorem]{Translation} \newtheorem[L]{investigation}[theorem]{Investigation} \newtheorem[L]{exploration}[theorem]{Exploration} in my macro section and

            <package>thmbox</package>

in my latex-preamble. I am attaching my pdf, which I have not yet uploaded to github nor to the web server. You can see the effect starting at page 35. Connected.pdf

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.[AAM6LBuRU-TQZgmOdld8upTp8izBDRCwks5soT83gaJpZM4I6Kze.gif]

sepvar commented 6 years ago

I am open to revisiting the issue in June 2018. I am happy enough with this hack to stop being distracted by it.... as you say.

I am also interested in making use of \marginpar; Since this seems to be a tangent, though, I will move my comments to https://groups.google.com/forum/?utm_source=digest&utm_medium=email#!searchin/pretext-dev/margin%7Csort:relevance/pretext-dev/Zljac6ACvz4/0HSdqHjLAgAJ

sepvar commented 6 years ago

This is a followup to this discussion, but specific to images. I raised the issue in https://groups.google.com/forum/?utm_source=digest&utm_medium=email#!topic/pretext-support/YT5DOA1ZpZ0

Earlier in this (github) thread I commented that It seems that in the tex file, the information is sorted as follows: xml "rename" xml "latex-image-preamble" xsl "latex.preamble.late" xml "latex-preamble" xml "macros"

Now I am finding that thmbox is interfering with my images. It looks like xml "latex-preamble" is not being included in the mbx process that creates SVG images. So, the xml "macros" commands do not have the correct \usepackage inclusions.

My hack solution is to move the thmbox inclusion into the xml "latex-image-preamble"

This seems to have solved the immediate problem.

rbeezer commented 6 years ago

The string parameters latex.preamble.* should be respected when we build the image files. This dependency for the macros was not an intended, or anticipated, use of the customization options.

See https://github.com/rbeezer/mathbook/issues/760

rbeezer commented 6 years ago

Comments at: https://groups.google.com/d/msg/pretext-support/YT5DOA1ZpZ0/IRe80kJ7BAAJ

rbeezer commented 5 years ago

There is a lot going on here. But with new LaTeX styles, it is easy to act on David's suggestions near the top. So at 41c796d5a8c82bfe8c9cf2fb14969b210564807d we now get

I'm going to close this. If there is something here you think is still outstanding, please put it on a new issue.