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

Overfull hbox when using subequations and empheq inside a minipage #63

Open
profjoaoalvesjr opened this issue Nov 15, 2024 · 4 comments

Comments

@profjoaoalvesjr
Copy link

I got 8 warnings of bad boxes, "Overfull \hbox (1.66663pt too wide)", when I compile the following code. When I use align instead of empheq, the bad boxes don't occur.

\documentclass[10pt, aspectratio=169]{beamer}
\usetheme{Berkeley}
\usepackage{empheq}

\begin{document}

\begin{frame}
\frametitle{Rotations in the plane}
\begin{minipage}[c]{0.34\textwidth}
\begin{figure}[H]
  \text{(FIGURE HERE)}\\
  \hspace{115pt}
\end{figure}  
\end{minipage}\hfill
\begin{minipage}[c]{0.64\textwidth}
  \begin{itemize}
    \item In an orthogonal coordinate system \( Oxy \), rotating a point \( P = (x, y) \) by an angle \( \theta \) around the origin, with \( r = \sqrt{x^2 + y^2} \), \( x = r \cos \alpha \), and \( y = r \sin \alpha \), results in the point \( P' = (x', y') \) such that
        \[  \begin{aligned}
              x' &= r\cos(\alpha+\theta) = r \cos \alpha \cos \theta - r \sin \alpha \sin \theta,\\
              y' &= r\sin(\alpha+\theta) = r \sin \alpha \cos \theta + r \sin \theta \cos \alpha;\\
            \end{aligned}\]
        that is,
        \begin{subequations}
        \label{E:RotPlanCoordOrt}
          \begin{empheq}[left=\empheqlbrace\,]{align}
            x' &= x \cos \theta - y \sin \theta, \label{E:RotPlanCoordOrtox}\\
            y' &= x \sin \theta + y \cos \theta. \label{E:RotPlanCoordOrtoy}
          \end{empheq}
        \end{subequations}
  \end{itemize}
\end{minipage}
\end{frame}

\end{document}

Teste

@daleif
Copy link
Collaborator

daleif commented Nov 18, 2024

Always make the example as small as possible.

This gives the same warnings. I'll have a look

\documentclass[10pt]{beamer}
\usepackage{empheq}
\begin{document}
\begin{frame}
  \begin{empheq}[left=\empheqlbrace\,]{align}
    x' &= x \cos \theta - y \sin \theta, \label{E:RotPlanCoordOrtox}\\
    y' &= x \sin \theta + y \cos \theta. \label{E:RotPlanCoordOrtoy}
  \end{empheq}
\end{frame}
\end{document}

Additionally, this does not give the warnings

%\documentclass[10pt]{beamer}
\documentclass[10pt]{article}
\usepackage{empheq}
\begin{document}
%\begin{frame}
  \begin{empheq}[left=\empheqlbrace\,]{align}
    x' &= x \cos \theta - y \sin \theta, \label{E:RotPlanCoordOrtox}\\
    y' &= x \sin \theta + y \cos \theta. \label{E:RotPlanCoordOrtoy}
  \end{empheq}
%\end{frame}
\end{document}

So it seems beamer is relevant.

@muzimuzhi
Copy link
Contributor

muzimuzhi commented Nov 18, 2024

Also the bad box only appears when a empheq-defined delimiter is used (like in left=\empheqlbrace) and the equation has tag(s).

Then inside \empheqlbrace, somehow the \EQ_tag_box was wider than .5\maxdimen, thus the overfull hbox warning in the use of \parbox{.5\maxdimen}{... \usebox{\EQ_tag_box} ...}.

Update: \EQ_tag_box is set by \EQ_typeset_tags: so the overfull hbox is also raised there.

mathtools/empheq.dtx

Lines 3492 to 3502 in 23e4b51

\def\EQ_declare_left_delimiter:nnnn #1#2#3#4{%
\@namedef{empheq#3\expandafter\@gobble\string#2}{%
\left#2%
\mkern-\thinmuskip
\vphantom{#4{\parbox{.5\maxdimen}{%
\EQ_predisplay_adjustment:
\EQ_prevent_vertical_space:
\usebox{\EQ_tag_box}%
\EQ_postdisplay_adjustment:}}}%
\right.%
\kern-\nulldelimiterspace #1}}

@daleif
Copy link
Collaborator

daleif commented Nov 19, 2024

@muzimuzhi it seems to also be only when \label is used.

@muzimuzhi
Copy link
Contributor

@daleif True.

Also the amount of overfull is the current value of \thinmuskip in pt. Change \thinmuskip and the overfull amount changes accordingly.

Running the example in #63 (comment) on overleaf.com, overfull hbox is reproducible in as early as texlive 2014.

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

No branches or pull requests

3 participants