fusion809 / fusion809.github.io

Franklin-powered website.
https://fusion809.github.io
GNU General Public License v3.0
1 stars 0 forks source link

Use PkgPage? #2

Open tlienart opened 4 years ago

tlienart commented 4 years ago

Apologies for the spam; I had a quick look at your website and given it's a single-page one, I was wondering whether you would maybe want to consider using PkgPage.jl which is single page, based on Franklin and comes with batteries included in terms of style? Migrating what you have now to it should take you a few minutes if that were something you'd be interested in.

The one reason why you might not want to do this is if you'd rather fully use your own CSS and layout (which is fine of course). I just thought I'd point out the alternative.

fusion809 commented 4 years ago

Thanks for the suggestion. I'm currently giving it a go. I must admit, I'm not the best at formatting using CSS and JS, I find them clumsy and ugly compared to Julia, so this is quite helpful.

fusion809 commented 4 years ago

Doesn't seem to play nice with my table. The text alignment is off, and tweaking it through editing the custom.css file is proving challenging, and there's no borders shown. Additionally my table really needs the entire page width to fit comfortable. So maybe PkgPage isn't really suited for my usecase. Thanks for the suggestion, however.

tlienart commented 4 years ago

if you have the trial code somewhere, would you mind pushing it to a repo that I could have a look?

There are three things potentially happening:

  1. the tables parser used in PkgPage is CommonMark.jl and requires strict alignment of the pipe symbols |
  2. there are custom bootstrap stylers you can use for the table, these can be passed fairly easily without having to do too much voodoo
  3. you can locally set the width to full page if required.

This is up to you though if you're happy the way things are now that's totally fine of course :)

fusion809 commented 4 years ago

Sure, here's where I uploaded the files: https://github.com/fusion809/PkgPage-FunInt. I didn't replace the entire index.md with stuff from this repo's FunctionIntegrator.md, only got up to the table part before I realized things weren't working properly.

tlienart commented 4 years ago

alright so there's two things going on here:

  1. you're not actually using PkgPage's \table command (or, in fact, the \figure command), this is fine but as a result your table is un-styled which is why you see it without separation same for figure
  2. if you were to use the \table it would still fail because of CommonMark.jl's rules of aligning pipes, this is a nuisance for which I've opened an issue, if it doesn't get resolved there, I'll remove the dependency on CM for now and will revert to the base table parsing

Side note:

fusion809 commented 4 years ago

Just gave using \table a go and serve() crashed with the error:

... encountered an issue processing 'index.md' in .../PkgPage-FunInt/page. Verify, then start franklin again...

e = ErrorException("A \\table{...} had improper specs:\n(\"\"\"\n| Function               | Domain~~~<sup>2</sup>~~~ | Weight | Arguments | Notes |\n|------------------------|--------|--------|-----------|-------|\n| `chebyshev_quadrature` | \$[a,b]\$~~~<br/>~~~\$x\\in[-1,1]\$ | \$k=1\$: \$\\dfrac{1}{\\sqrt{1-x^2}}\$~~~<br/><br/>~~~\$k=2\$: \$\\sqrt{1-x^2}\$~~~<br/><br/>~~~\$k=3\$: \$\\sqrt{\\dfrac{1+x}{1-x}}\$~~~<br/><br/>~~~\$k=4\$: \$\\sqrt{\\dfrac{1-x}{1+x}}\$ | `f`, the function being integrated. ~~~<br/>~~~`N`, the number of grid points.~~~<br/>~~~`k`, the type of Chebyshev quadrature being used. 1, 2, 3, and 4 refer to the Chebyshev \$T_n\$, \$U_n\$, \$V_n\$ and \$W_n\$ polynomials respectively.~~~<br/>~~~`a`, the start of the domain of integration.~~~<br/>~~~`b`, the end of the domain of integration. | Uses [Chebyshev-Gauss quadrature](https://en.wikipedia.org/wiki/Chebyshev%E2%80%93Gauss_quadrature) (note this article does not mention 3rd and 4th quadrature types, corresponding to \$k=3\$ and \$k=4\$, respectively). If there are unremovable singularities at the endpoints, it with \$k=1\$ or `legendre_quadrature` are preferred. |\n| `hermite_quadrature`   | \$[-\\infty,\\infty]\$ | \$e^{-x^2}\$ | `f`, the function being integrated.~~~<br/>~~~`N`, the number of grid points.~~~<br/>~~~`k` determines the problem being solved (whether \$e^{-x^2}\$ is assumed to be part of the integrand (\$k=2\$) or not). | Uses [Gauss-Hermite quadrature](https://en.wikipedia.org/wiki/Gauss%E2%80%93Hermite_quadrature). Only use this if your integration domain is \$[-\\infty,\\infty]\$ and your integrand rapidly goes to zero as the absolute value of \$x\$ gets larger. |\n| `jacobi_quadrature`    | \$[a,b]\$~~~<br/>~~~\$x\\in[-1,1]\$ | \$(1-x)^{\\alpha}(1+x)^{\\beta}\$ | `f`, the function being integrated.~~~<br/>~~~`N`, the number of grid points.~~~<br/>~~~`α` and `β` are parameters of the weighting function.~~~<br/>~~~`a`, the start of the domain of integration.~~~<br/>~~~`b`, the end of the domain of integration. | Uses [Gauss-Jacobi quadrature](https://en.wikipedia.org/wiki/Gauss%E2%80%93Hermite_quadrature). After controlling for `N` it is one of the slowest quadrature methods. A condition of Gauss-Jacobi quadrature is that \$\\alpha, \\beta \\gt -1\$. When \$\\alpha = \\beta = 0\$, this reduces to `legendre_quadrature`. |\n| `laguerre_quadrature`  | \$[0,\\infty]\$ | \$e^{-x}\$ | `f`, the function being integrated.~~~<br/>~~~`N`, the number of grid points.~~~<br/>~~~`k` determines the problem being solved (whether \$e^{-x}\$ is assumed to be part of the integrand (\$k=2\$) or not). | Uses [Gauss-Laguerre quadrature](https://en.wikipedia.org/wiki/Gauss%E2%80%93Laguerre_quadrature). Only use this if your integration domain is \$[0,\\infty]\$ and your integrand rapidly goes to \$0\$ as \$x\$ gets larger. |\n| `legendre_quadrature`  | \$[a,b]\$~~~<br/>~~~\$x\\in[-1,1]\$ | 1 | `f`, the function being integrated.~~~<br/>~~~`N`, the number of grid points.~~~<br/>~~~`a`, the start of the domain of integration.~~~<br/>~~~`b`, the end of the domain of integration. | Uses [Gauss-Legendre quadrature](https://en.wikipedia.org/wiki/Gauss%E2%80%93Legendre_quadrature). Generally, this is the best `_quadrature` function to go with when you are otherwise unsure which to go with. |\n| `lobatto_quadrature`   | \$[a,b]\$~~~<br/>~~~\$x\\in[-1,1]\$ | 1 | `f`, the function being integrated.~~~<br/>~~~`N`, the number of grid points.~~~<br/>~~~`a`, the start of the domain of integration.~~~<br/>~~~`b`, the end of the domain of integration. | Uses [Gauss-Lobatto quadrature](https://en.wikipedia.org/wiki/Gaussian_quadrature#Gauss%E2%80%93Lobatto_rules). This function includes, in the calculation, the values of the integrand at one of the endpoints. Consequently, if there are unremovable singularities at the endpoints, this function may fail to give an accurate result even if you adjust the endpoints slightly to avoid the singularities. |\n| `radau_quadrature`     | \$[a,b]\$~~~<br/>~~~\$x\\in[-1,1]\$ | 1 | `f`, the function being integrated.~~~<br/>~~~`N`, the number of grid points.~~~<br/>~~~`a`, the start of the domain of integration.~~~<br/>~~~`b`, the end of the domain of integration. | Uses Gauss–Radau quadrature, for which there is no Wikipedia article, the best article (simplest) I could find on it are [these lecture notes](https://web.archive.org/web/20200628202423/http://www.math.hkbu.edu.hk/ICM/LecturesAndSeminars/08OctMaterials/2/Slide3.pdf). This function includes, in the calculation, the values of the function at the endpoints. Consequently, if there are unremovable singularities at either or both of the endpoints, this function will fail to give an accurate result even if you adjust the endpoints slightly to avoid the singularities. |\n| `rectangle_rule_left`  | \$[a,b]\$ | N/A | `f`, the function being integrated.~~~<br/>~~~`N`. \$N\$ is the number of grid points used in the integration.~~~<br/>~~~`a`, the start of the domain of integration.~~~<br/>~~~`b`, the end of the domain of integration. | Uses the rectangle rule, specifically the [left Riemann sum](https://en.wikipedia.org/wiki/Riemann_sum#Left_Riemann_sum). Usually this or `rectangle_rule_right` is the least accurate method. In fact, many of the tests in the FunctionIntegrator.jl repository fail to get accuracy to 7 significant figures with `rectangle_rule_left` with any practically viable value of `N`. |\n| `rectangle_rule_midpoint`  | \$[a,b]\$ | N/A | `f`, the function being integrated.~~~<br/>~~~`N`. \$N\$ is the number of grid points used in the integration.~~~<br/>~~~`a`, the start of the domain of integration.~~~<br/>~~~`b`, the end of the domain of integration. | Uses the rectangle rule, specifically the [Riemann midpoint rule](https://en.wikipedia.org/wiki/Riemann_sum#Midpoint_rule). Usually this is more accurate than `rectangle_rule_left` and `rectangle_rule_right` and sometimes rivals `trapezoidal_rule` for accuracy. Interestingly, going by my Travis tests it appears to be even more efficient than `simpsons_rule`. |\n| `rectangle_rule_right`  | \$[a,b]\$ | N/A | `f`, the function being integrated.~~~<br/>~~~`N`. \$N\$ is the number of grid points used in the integration.~~~<br/>~~~`a`, the start of the domain of integration.~~~<br/>~~~`b`, the end of the domain of integration. | Uses the rectangle rule, specifically the [right Riemann sum](https://en.wikipedia.org/wiki/Riemann_sum#Right_Riemann_sum). Usually this or `rectangle_rule_left` is the least accurate method. In fact, many of the tests in the FunctionIntegrator.jl repository fail to get accuracy to 7 significant figures with `rectangle_rule_right` with any practically viable value of `N`. |\n| `simpsons_rule`        | \$[a,b]\$ | N/A | `f`, the function being integrated.~~~<br/>~~~`N`. \$N+1\$ is the number of grid points, if endpoints are included.~~~<br/>~~~`a`, the start of the domain of integration.~~~<br/>~~~`b`, the end of the domain of integration. | Uses [Simpson's rule](https://en.wikipedia.org/wiki/Simpson%27s_rule). It is one of the best functions to use when you are unsure which to use, provided there are no unremovable singularities within the integration domain, including the endpoints. |\n| `trapezoidal_rule`     | \$[a,b]\$ | N/A | `f`, the function being integrated.~~~<br/>~~~`N`. \$N+1\$ is the number of grid points, if endpoints are included.~~~<br/>~~~`a`, the start of the domain of integration.~~~<br/>~~~`b`, the end of the domain of integration. | Uses the [trapezoidal rule](https://en.wikipedia.org/wiki/Trapezoidal_rule). It has the same caveats as `simpsons_rule`. |\n\"\"\",); verify.")

Is that the CommonMark.jl error you're referring to?

tlienart commented 4 years ago

Here there are several issues combining but in short yes