55 LaTeX Support – Villy Christensen 2
Book: https://pressbooks.bccampus.ca/ewemodel
Date: January 9th, 2023
Issue:
- Label equations (QuickLaTeX) using ?? is on the left, with the equation aligned left in PDF. Want equation centred and with label on right, aligned to right margin
Afflicted chapters:
- https://pressbooks.bccampus.ca/ewemodel/chapter/predicting-consumption/
- https://pressbooks.bccampus.ca/ewemodel/chapter/ecosim-introduction/
- https://pressbooks.bccampus.ca/ewemodel/chapter/tutorial-time-series-fitting/
- https://pressbooks.bccampus.ca/ewemodel/chapter/fleet-effort-dynamics/
- https://pressbooks.bccampus.ca/ewemodel/chapter/lotka-volterra/
References:
- https://www.overleaf.com/learn/latex/Cross_referencing_sections%2C_equations_and_floats#Compiling_documents_with_cross_references
- https://en.wikibooks.org/wiki/LaTeX/Labels_and_Cross-referencing
- https://pressbooks.community/t/mathjax-tags-formatting-and-pdf-exports/2380
- https://guide.pressbooks.com/chapter/apply-custom-styles/
- https://guide.pressbooks.com/chapter/apply-custom-styles/#chapter-362-section-1
- https://pressbooks.community/t/display-of-mathjax-equations-in-pdf/1263/4
- https://opentextbc.ca/publishingstyleguide/chapter/custom-styles/
ref: 50
Results notes:
Solution:
Hi Villy,
Apologies for the long wait. It’s been busy around here and I also wanted to give you a thorough answer.
Unfortunately, it doesn’t look like there is a way to fix the alignment of the equations or equation number in the exports using QuickLaTeX. I was looking into trying to force it using CSS but wasn’t able to find a solution.
In regards to the linking, it appears that, for your purposes, there are pros and cons to using either QuickLaTeX (the plugin that you activated) or Mathjax (the default when not using QuickLaTeX on Pressbooks). So I wanted to give you a thorough rundown of the capabilities of both so you can make an informed decision of what would work best for you. The following is the result of my testing and research:
When using QuickLaTeX:
- Any math equations in EPUB and PDF are not centred, even if manually centred, but are in web book.
- Caveat: Equations are centred using “
(1)
” or using “Align Centre” button in Visual Editor to centre it. If neither of these are used, the equations will not be centred in web book.
- Caveat: Equations are centred using “
- \label{} and ?? work links work in EPUB and web book but not PDF.
- Do not use “
” shortcodes around ??
- Do not use “
- You must use “
(2)
” for \label{} and ?? to work.
- You must use “
(x)
” for \tag{} to work.
- Without a \tag{}, the equation number will default to the number of equations on page (when using “
(3)
“).
When using Mathjax:
- Any math equations in EPUB, PDF and web book are centred.
- \tag{} works and is set on right side in EPUB, PDF and web book.
- \label{} does not work in any format using Mathjax.
- ?? works in web book with \tag{} if using “
(x)
” but not in EPUB or PDF.
- Do not use “
” shortcodes around ??.
- In the EPUB and PDF exports, it simply shows the code.
- Do not use “
- You can get a similar functionality using anchors and links rather than \label{} and ??
- Refer to the section “Internal Links” in the Hyperlink Material chapter of the Pressbooks Guide.
- This works both in Mathjax and QuickLaTeX as it is core Pressbooks functionality.
- You use \tag{} without “
(4)
” and it will still number the equation.
- Without a \tag{}, it will not number equations (with or without using “
(5)
“).
Please let me know if you have need me to clarify anything or have any other questions. Again, apologies for taking so. Long to get back to you.
Cheers,
Without using “tag{}”, without using “eq:” in label
(6)
Without using “tag{}”, using “eq:” in label
(7)
Using “tag{}”, without using “eq:” in label
(3)
Using “tag{}”, Using “eq:” in label
(eq:4)
Centring equation manually
(eq:5)
Using just “tag{}” without \label{} in “begin{equation}”
(39420)
Using anchors and links instead of \label and \ref. Still using \tag
(50)
Writing normal LaTeX equation without “begin{equation}” and trying to use “tag{}”. Is centred
Writing normal LaTeX equation without “begin{equation}” and trying to use “tag{}”. Not centred
Writing short LaTeX equation using “begin{equation}”. Is centred
(56)
Writing short LaTeX equation using “begin{equation}”. Not centred
(57)