Math & Science ⇒ Equation not centered
Re: Equation not centered
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
- Stefan Kottwitz
- Site Admin
- Posts: 10335
- Joined: Mon Mar 10, 2008 9:44 pm
Equation not centered
\makebox
with a value of 0pt
. With 0pt
we get a line break though, but let's choose the smallest TeX unit and it works. Just insert right before your \makeatother
:Code: Select all
\renewcommand*{\maketag@@@}[1]{\hbox{\m@th\normalfont{\makebox[1sp][r]{#1}}}}
Re: Equation not centered
Unfortunately, it may cause problems with lots of other equations (I didn't checked yet).
Is there a way to achieve the same effect on a particular equation, without affecting the others ?
Equation not centered
Stefan, your modification affects all the equation references in the text. Just add a
\label{}
to an equation and use \eqref{}
in the text, and it will be messed-up !Equation not centered
nospace
:Code: Select all
\newtagform{nospace}[\llap\bgroup(]{}{\egroup)}
\usetagform
.Here is a complete example (also note that I change the equation counter with amsmath's
\numberwithin
):Code: Select all
\documentclass{book}
\usepackage{mathtools}
\usepackage{tensor}
\newtagform{nospace}[\llap\bgroup(]{}{\egroup)}
\numberwithin{equation}{section}
\usepackage[nopar]{lipsum}% for dummy text
\begin{document}
\chapter{Blah}
\section{Blub}
\lipsum[4]
\usetagform{nospace}
\begin{equation}
\frac{d^2 \, \displaystyle{\tensor{x}{^{\lambda}}}}{d\, \sigma^2} +
\Gamma_{\mu \nu}^{\lambda} \; \frac{d\, \displaystyle{\tensor{x}{^{\mu}}}}{d\, \sigma} \,
\frac{d\, \displaystyle{\tensor{x}{^{\nu}}}}{d\, \sigma} =
\frac{d\, \displaystyle{\tensor{x}{^{\lambda}}}}{d\, \sigma} \,
\frac{d\, }{d\, \sigma} \, \ln \sqrt{\, \tensor{g}{_{\mu \nu}} \;
\frac{d\, \displaystyle{\tensor{x}{^{\mu}}}}{d\, \sigma} \,
\frac{d\, \displaystyle{\tensor{x}{^{\nu}}}}{d\, \sigma}}.
\end{equation}
\usetagform{default}
\lipsum[4]
\begin{equation}
\tensor{g}{_{\mu \nu}} \; \frac{d\, \displaystyle{\tensor{x}{^{\mu}}}}{d\, \sigma} \,
\frac{d\, \displaystyle{\tensor{x}{^{\nu}}}}{d\, \sigma} =
\tensor{g}{_{\mu \nu}} \; \frac{d\, \displaystyle{\tensor{x}{^{\mu}}}}{d\, \tau} \,
\frac{d\, \displaystyle{\tensor{x}{^{\nu}}}}{d\, \tau} \,
\Big( \, \frac{d\, \tau}{d\, \sigma} \Big)^{\! 2} \equiv
\Big( \, \frac{d\, \tau}{d\, \sigma} \Big)^{\! 2}.
\end{equation}
\lipsum[4]
\end{document}
Re: Equation not centered
Equation not centered
Since I'm already using the mathtools package in my real document, I may simply add this code to the preamble :
Code: Select all
\newtagform{nospace}[\llap\bgroup(]{}{\egroup)}
Code: Select all
\makeatletter
\renewcommand\theequation{\thesection.\arabic{equation}}
\@addtoreset{equation}{section}
\makeatother
\usetagform{nospace}
and \usetagform{default}
around a special equation solves the issue for that particular equation. All other equations are left untouched.Equation not centered
You can replace this withCham wrote:just under my usual tag modification :Code: Select all
\makeatletter \renewcommand\theequation{\thesection.\arabic{equation}} \@addtoreset{equation}{section} \makeatother
Code: Select all
\numberwithin{equation}{section}
Regards
Equation not centered
Hmmm, yes. But I must admit that I'm pretty nervous about modifying my preamble, because my document is now so large and complex, I don't want to mess with this huge castle of cards.cgnieder wrote: You can replace this withIt has the same effect.Code: Select all
\numberwithin{equation}{section}
Changing just a single line of code in the preamble may have HUGE consequences on the whole document.
Equation not centered
Is there any inconvenience about that solution ?
Apparently, it's working very well in my document (but I didn't checked all of the 700 pages yet!), and as I said in my previous message, I'm more and more reluctant to modify my preamble (it's now a huge "castle of cards").