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

Improved typesetting of probability functions. #2075

Closed

Conversation

godbyk
Copy link
Contributor

@godbyk godbyk commented May 12, 2018

By using the new \p and \P macros, probability functions will be typeset
more consistently and cleanly. The syntax of both macros is the same.
Examples:

\p{z}
\p{z | a, b}
\p*{z | \frac{1}{2}}
\p[\big]{\frac{A}{B}}

The pipe (|) will have the proper spacing automatically.
The \p* variant will autoscale the parentheses and vertical bar to fit the contents of the expressions.
You can specify a particular size using the \p[<size>] variant.
Possible sizes are \big, \Big, \bigg, and \Bigg.

The p or P is set in roman instead of italics, but this can be changed if you prefer p and P.

@Eelis
Copy link
Contributor

Eelis commented May 12, 2018

(Since implementing the functionality of that new mathtools LaTeX package is too much work for cxxdraft-htmlgen, this change will result in some divergence with the HTML version.)

@godbyk
Copy link
Contributor Author

godbyk commented May 12, 2018

@Eelis I'm afraid I'm unfamiliar with cxxdraft-htmlgen. Is there a mechanism to provide a simplified, equivalent form of \p and \P for cxxdraft-htmlgen to parse so it doesn't have to read the real definitions?

@Eelis
Copy link
Contributor

Eelis commented May 12, 2018

@godbyk Ah, it's the tool that generates eel.is/c++draft, which is used a lot for citations in online discussions and documentation, because it's very link-friendly (unlike the PDF).

I could easily make cxxdraft-htmlgen ignore the new stuff in macros.tex, and I could define my own replacements for \p and \P that just do a dumb expansion, but I guess I'd end up with poor spacing/sizing.

@tkoeppe
Copy link
Contributor

tkoeppe commented Jun 7, 2018

Could you kindly provide some diff screenshots?

@tkoeppe tkoeppe added the needs rebase The pull request needs a git rebase to resolve merge conflicts. label Jun 7, 2018
By using the new `\p` and `\P` macros, probability functions will be typeset
more consistently and cleanly.  The syntax of both macros is the same.
Examples:

    \p{z}
    \p{z | a, b}
    \p*{z | \frac{1}{2}}
    \p[\big]{\frac{A}{B}}

The pipe (|) will have the proper spacing automatically.
The `\p*` variant will autoscale the parentheses and vertical bar to fit the contents of the expressions.
You can specify a particular size using the `\p[<size>]` variant.
Possible sizes are `\big`, `\Big`, `\bigg`, and `\Bigg`.
@godbyk godbyk force-pushed the improve-probability-typesetting branch from 9d01245 to e23b8ca Compare June 19, 2018 04:08
@godbyk
Copy link
Contributor Author

godbyk commented Jun 19, 2018

@tkoeppe I've rebased the branch on master and uploaded a PDF showing the diffs in the numerics chapter (see pages 16–17 and 31–46).

You should only see slight adjustments in the horizontal space around the vertical bar.

(There are a number of other improvements that could be made to the mathematics typesetting in this chapter, but I'll leave those for separate issues/PRs.)

@jensmaurer jensmaurer removed the needs rebase The pull request needs a git rebase to resolve merge conflicts. label Jun 27, 2018
@tkoeppe
Copy link
Contributor

tkoeppe commented Jul 2, 2018

So... as much as I appreciate this effort, and as much as I enjoy proper operator spacing, I must say that a) the status quo is by no means bad here, b) the visual difference that this change makes is very minor, c) it requires a lot of new setup, and d) it hogs two extremely short macro names for something extremely niche that we never ever use again outside that one subclause.

At this point, I would like to ask if you would mind if we just drop this. If not, we can explore alternatives and modifications, but all told I think there are more interesting fires I'd like to put out at this point (e.g. indexing, getting rid of requirements tables, and converting the LFTS to LaTeX).

@godbyk
Copy link
Contributor Author

godbyk commented Jul 2, 2018

@tkoeppe I don't mind. I just pulled code in from my own collection of macros, so there wasn't a ton of dev effort in this.

What's the LFTS? I'm happy to help with other LaTeX-related issues if you need a hand.

@tkoeppe
Copy link
Contributor

tkoeppe commented Jul 2, 2018

OK, let's close this then.

The LFTS is the Library Fundamentals TS: https://github.com/cplusplus/fundamentals-ts

It's currently in some obsolescent state of XML. My current plan is to divine an XSLT rule to transform it into our familiar LaTeX.

@tkoeppe tkoeppe closed this Jul 2, 2018
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