Cleaned up the repo and fixed some bugs.
This commit is contained in:
Executable
+119
@@ -0,0 +1,119 @@
|
||||
% Improved newspaper-mod.sty for ProostenKrant
|
||||
% Better image handling for different formats and sizes
|
||||
|
||||
\newcommand{\headlinestyle}{\itshape\huge}
|
||||
\newcommand{\bylinestyle}{\scshape\Large}
|
||||
\patchcmd{\headline}{#1}{\headlinestyle #1}{}{}
|
||||
\patchcmd{\byline}{#1}{\bylinestyle #1}{}{}
|
||||
|
||||
% Improved image commands with better handling of different aspect ratios
|
||||
|
||||
% Show inline image with caption (automatically handles landscape and portrait)
|
||||
\newcommand{\showInlineImage}[2]
|
||||
{
|
||||
\\\n \hspace*{0pt}% Ensure proper spacing
|
||||
\vspace*{10pt}% Add space before image
|
||||
\begin{center}
|
||||
\begin{minipage}{0.95\columnwidth}
|
||||
\centering
|
||||
% Use max dimensions that fit in column
|
||||
\setlength{\fboxsep}{5pt}
|
||||
\framebox{
|
||||
% Check image dimensions and scale appropriately
|
||||
\includegraphics[max width=\linewidth, max height=0.6\textheight, keepaspectratio]{#1}
|
||||
}
|
||||
\vspace*{5pt}
|
||||
{\small #2}
|
||||
\end{minipage}
|
||||
\end{center}
|
||||
\vspace*{10pt}% Add space after image
|
||||
\par
|
||||
}
|
||||
|
||||
% Show single writer with circular profile image
|
||||
\newcommand{\showOneWriter}[2]
|
||||
{
|
||||
\\\n \hfill
|
||||
\begin{minipage}[t]{0.4\columnwidth}
|
||||
\centering
|
||||
\begin{tikzpicture}
|
||||
% Circular clip for profile image
|
||||
\clip (0,0) circle (1.3cm);
|
||||
% Use square aspect ratio and scale to fit
|
||||
\node[anchor=center] at (0,0) {
|
||||
\includegraphics[width=2.8cm, height=2.8cm, keepaspectratio]{#1}
|
||||
};
|
||||
\end{tikzpicture}
|
||||
\vspace*{5pt}
|
||||
{\small #2}
|
||||
\end{minipage}
|
||||
\hfill
|
||||
\\\n}
|
||||
|
||||
% Show two writers with circular profile images
|
||||
\newcommand{\showTwoWriters}[4]
|
||||
{
|
||||
\\\n \begin{center}
|
||||
\begin{minipage}[t]{0.8\columnwidth}
|
||||
\centering
|
||||
\begin{tikzpicture}
|
||||
\clip (0,0) circle (1.1cm);
|
||||
\node[anchor=west] at (0,0) {
|
||||
\includegraphics[width=2.4cm, height=2.4cm, keepaspectratio]{#1}
|
||||
};
|
||||
\end{tikzpicture}
|
||||
\hspace*{15pt}
|
||||
\begin{tikzpicture}
|
||||
\clip (0,0) circle (1.1cm);
|
||||
\node[anchor=east] at (0,0) {
|
||||
\includegraphics[width=2.4cm, height=2.4cm, keepaspectratio]{#3}
|
||||
};
|
||||
\end{tikzpicture}
|
||||
\vspace*{8pt}
|
||||
{\small #2 \\quad #4}
|
||||
\end{minipage}
|
||||
\end{center}
|
||||
\\\n}
|
||||
|
||||
% Alternative commands for different layouts
|
||||
|
||||
% For portrait images - maintains aspect ratio
|
||||
\newcommand{\showPortraitImage}[2]
|
||||
{
|
||||
\\\n \begin{minipage}[t]{0.45\columnwidth}
|
||||
\centering
|
||||
\begin{tikzpicture}
|
||||
% For portrait images, use vertical layout
|
||||
\clip (0,-1.5cm) rectangle (2cm,1.5cm);
|
||||
\node[anchor=center] at (1cm,0) {
|
||||
\includegraphics[height=3cm, keepaspectratio]{#1}
|
||||
};
|
||||
\end{tikzpicture}
|
||||
\vspace*{5pt}
|
||||
{\small #2}
|
||||
\end{minipage}
|
||||
\\\n}
|
||||
|
||||
% For landscape images - maintains aspect ratio
|
||||
\newcommand{\showLandscapeImage}[2]
|
||||
{
|
||||
\\\n \begin{minipage}[t]{\columnwidth}
|
||||
\centering
|
||||
% For landscape images, use full width
|
||||
\includegraphics[width=\linewidth, height=0.4\textheight, keepaspectratio]{#1}
|
||||
\vspace*{5pt}
|
||||
{\small #2}
|
||||
\end{minipage}
|
||||
\\\n}
|
||||
|
||||
% Flexible image wrapper that automatically handles different orientations
|
||||
\newcommand{\showFlexibleImage}[2]
|
||||
{
|
||||
% First, we need to check the image dimensions
|
||||
% This requires the epstopdf package and shell-escape
|
||||
\IfFileExists{#1}{
|
||||
% Image exists, try to determine orientation
|
||||
% For now, we'll use a balanced approach that works for both
|
||||
\showInlineImage{#1}{#2}
|
||||
}{}
|
||||
}
|
||||
Reference in New Issue
Block a user