-
Notifications
You must be signed in to change notification settings - Fork 26
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
Resize long expressions in LaTeX to prevent overflow #3910
Conversation
The new pdfs are an improvement over the previous ones. I like this change to the generated stable files. @JacquesCarette or @balacij should review the Drasil code changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor, likely non-blocking notes on another solid PR!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, but since you've opened this can of worms, may as well do it right!
@@ -311,7 +322,7 @@ \subsubsection{Theoretical Models} | |||
|
|||
\\ \midrule | |||
Equation & \begin{displaymath} | |||
\symbf{a}\text{(}t\text{)}=\frac{\,d\symbf{v}\text{(}t\text{)}}{\,dt} | |||
\resizeExpression{\symbf{a}\text{(}t\text{)}=\frac{\,d\symbf{v}\text{(}t\text{)}}{\,dt}}{0.8} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can predict that we'll likely want more processing of expressions in the future, so may as well abstract from that now. In other words, introduce a \formatExpr
macro that wraps expressions, which would then just be resizeExpression{#1}{0.8}
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we have both \resizeExpression{#1}{0.8}
(printed by lo'
) and \resizeExpression{#1}{1.0}
(printed by lo
), does that mean we need to introduce two macros? For a more detailed explanation on why the differences in scale exist, please refer to #3910 (comment).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. The macro should take a parameter that indicates whether to choose the in-definition or outside-definition case. While there should be booleans, it might still make sense to give them symbolic names, to make it clear what the meaning of the parameter is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To clarify, are you suggesting the following?
In addition to the existing variables/commands I created in this PR, which are as follows:
\def\inDefScale{0.8}
\def\outDefScale{1.0}
\newsavebox{\mybox}
\newcommand{\resizeExpression}[2]{
\savebox{\mybox}{$#1$}
\ifdim\wd\mybox>#2\linewidth
\resizebox{#2\textwidth}{!}{\usebox{\mybox}}
\else
\usebox{\mybox}
\fi
}
we want the following macro:
\newcommand{\InDef}{true}
\newcommand{\OutDef}{false}
\newcommand{\formatExpr}[2]{
\if#2
\resizeExpression{#1}{\inDefScale}
\else
\resizeExpression{#1}{\outDefScale}
\fi
}
Thus, expressions will be printed as follows:
\formatExpr{...}{\outDef} % Outside definition table
\formatExpr{...}{\inDef} % Inside definition table
That’s how I understand it. Please let me know if I’ve misunderstood anything.
Contributes to #718
To save you the trouble of compiling, here is a precompiled example of SSP_SRS.pdf for your reference.