- Improve bigfloat behavior.

- Add Hyphenation package.
- Make margin figure caption ragged right/left depending on page.
This commit is contained in:
Silcantar
2025-07-11 23:06:02 -05:00
parent 8dfaf66c18
commit c1f308ad19
5 changed files with 52 additions and 27 deletions

View File

@@ -6,6 +6,7 @@
% Graphics package for including images % Graphics package for including images
\RequirePackage{graphicx} \RequirePackage{graphicx}
\RequirePackage[hypcap=true]{caption} \RequirePackage[hypcap=true]{caption}
\RequirePackage{calc}
\newcommand{\ig}[2][0.5in]{ \newcommand{\ig}[2][0.5in]{
\includegraphics[keepaspectratio,width=#1]{#2} \includegraphics[keepaspectratio,width=#1]{#2}
@@ -23,10 +24,10 @@
\newcommand{\centerfigw}[4][\textwidth]{\cfig{#2}{#3}{#4}{\includegraphics[keepaspectratio,width=#1]}} \newcommand{\centerfigw}[4][\textwidth]{\cfig{#2}{#3}{#4}{\includegraphics[keepaspectratio,width=#1]}}
\newcommand{\bigfig}[4][1in]{% \newcommand{\bigfig}[4][1in]{%
\bigfloat[#1]{% \bigfloat[#1]{figure}{%
\captionsetup{type=figure}% \captionsetup{type=figure}%
\includegraphics[keepaspectratio,width=\bfFigureWidth]{#2}% \includegraphics[keepaspectratio,width=\textwidth]{#2}%
\captionof{figure}{#4}% \centering\captionof{figure}{#4}\par%
\label{fig:#3}% \label{fig:#3}%
}% }%
} }

6
Hyphenation.sty Normal file
View File

@@ -0,0 +1,6 @@
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{PrimeTeX/Hyphenation}[2025-07-11]
\hyphenation{
over-view
}

View File

@@ -10,30 +10,19 @@
%#region %#region
\RequirePackage[pass]{geometry} \RequirePackage[pass]{geometry}
\RequirePackage{calc} \RequirePackage{calc}
\RequirePackage{ifoddpage} \RequirePackage{changepage}
\newlength{\contentwidth} \newlength{\contentwidth}
\setlength{\contentwidth}{\textwidth+\marginparsep+\marginparwidth} \setlength{\contentwidth}{\textwidth+\marginparsep+\marginparwidth}
\newlength{\bfFigureWidth} \newcommand{\bigfloat}[3][1in]{%
\newlength{\bfMarginOffset} \begin{#2}[htp]%
\newcommand{\bigfloat}[2][1in]{% \begin{adjustwidth*}{-#1}{-#1}%
\setlength{\bfFigureWidth}{#1*-2+\paperwidth}% \begin{minipage}{#1 * 2 + \textwidth}%
\checkoddpage% #3%
\ifoddpage%
\setlength{\bfMarginOffset}{-1in+#1-\oddsidemargin}%
\else%
\setlength{\bfMarginOffset}{-1in+#1-\evensidemargin}%
\fi%
\begin{figure}[ht]%
{\leavevmode%
\put(\bfMarginOffset,0in){%
\begin{minipage}{\bfFigureWidth}%
#2%
\end{minipage}% \end{minipage}%
}% \end{adjustwidth*}%
}% \end{#2}%
\end{figure}%
} }
%#endregion %#endregion
@@ -52,3 +41,17 @@
\setlength{\parindent}{0pt} \setlength{\parindent}{0pt}
\setlength{\parskip}{2ex plus 0.5ex minus 0.5ex} \setlength{\parskip}{2ex plus 0.5ex minus 0.5ex}
%#endregion %#endregion
\renewcommand{\topfraction}{0.9} % max fraction of floats at top
\renewcommand{\bottomfraction}{0.8} % max fraction of floats at bottom
% Parameters for TEXT pages (not float pages):
\setcounter{topnumber}{2}
\setcounter{bottomnumber}{2}
\setcounter{totalnumber}{4} % 2 may work better
\setcounter{dbltopnumber}{2} % for 2-column pages
\renewcommand{\dbltopfraction}{0.9} % fit big float above 2-col. text
\renewcommand{\textfraction}{0.07} % allow minimal text w. figs
% Parameters for FLOAT pages (not text pages):
\renewcommand{\floatpagefraction}{0.7} % require fuller float pages
% N.B.: floatpagefraction MUST be less than topfraction !!
\renewcommand{\dblfloatpagefraction}{0.7} % require fuller float pages

View File

@@ -15,6 +15,8 @@
\RequirePackage{PrimeTeX/Graphics} \RequirePackage{PrimeTeX/Graphics}
\RequirePackage{PrimeTeX/Hyphenation}
\RequirePackage{PrimeTeX/Index} \RequirePackage{PrimeTeX/Index}
\RequirePackage{PrimeTeX/Layout} \RequirePackage{PrimeTeX/Layout}

View File

@@ -35,14 +35,27 @@
}[#1]% }[#1]%
} }
\RequirePackage{changepage}
\RequirePackage{ifthen}
\newcommand{\mfig}[5][0pt]{% \newcommand{\mfig}[5][0pt]{%
% This strut ensures that the margin figure is counted as part of the % This strut ensures that the margin figure is counted as part of the
% following paragraph and is vertically aligned with it. % following paragraph and is vertically aligned with it.
\strut% \strut%
\marginnote{% \marginnote{%
\checkoddpage%
\ifthenelse{\boolean{oddpage}}{%
\captionsetup{% \captionsetup{%
type = figure,% type = figure,%
font = {color=marginTextColor},% font = {color=marginTextColor},%
justification = raggedright,%
}%
}{%
\captionsetup{%
type = figure,%
font = {color=marginTextColor},%
justification = raggedleft,%
}%
}% }%
{\centering#5{#2}\par}% {\centering#5{#2}\par}%
\captionof{figure}{#4}% \captionof{figure}{#4}%