mirror of
				https://github.com/flynx/photobook.git
				synced 2025-10-31 19:30:08 +00:00 
			
		
		
		
	fixed caption cell positioning for all alignment and fit/fill modes... (hopefully)
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									353500d64d
								
							
						
					
					
						commit
						bc79b6ecb6
					
				| @ -1263,15 +1263,12 @@ | |||||||
| %		- offset fix for fill mode... | %		- offset fix for fill mode... | ||||||
| %		- caption cell in fill mode... | %		- caption cell in fill mode... | ||||||
| %		- do we need to reverse left/right for fill? (feels counter-intuitive) | %		- do we need to reverse left/right for fill? (feels counter-intuitive) | ||||||
| % XXX HACK -- need to track down where is this coming from and either  |  | ||||||
| %		set it to zero or account for it correctly.... |  | ||||||
| % XXX RENAME -- make this global... |  | ||||||
| \newlength\photobook@HOFFSETFIX |  | ||||||
| \setlength\photobook@HOFFSETFIX{1.5pt} |  | ||||||
| 
 | 
 | ||||||
| % XXX should these be lengths or macros??? | % XXX should these be lengths or macros??? | ||||||
| \def\photobook@imagecell@top{0pt} | \def\photobook@imagecell@top{0pt} | ||||||
| \def\photobook@imagecell@left{0pt} | \def\photobook@imagecell@left{0pt} | ||||||
|  | \def\photobook@imagecell@captiontop{0pt} | ||||||
|  | \def\photobook@imagecell@captionleft{0pt} | ||||||
| 
 | 
 | ||||||
| \newlength\photobook@imagecell@clearance | \newlength\photobook@imagecell@clearance | ||||||
| \setlength\photobook@imagecell@clearance{0pt} | \setlength\photobook@imagecell@clearance{0pt} | ||||||
| @ -1287,21 +1284,30 @@ | |||||||
| 		+0.5\cellheight  | 		+0.5\cellheight  | ||||||
| 		-0.5\ht\photobook@imagebox \relax}% | 		-0.5\ht\photobook@imagebox \relax}% | ||||||
| 	\def\photobook@imagecell@left{\dimexpr  | 	\def\photobook@imagecell@left{\dimexpr  | ||||||
| 		+\photobook@HOFFSETFIX |  | ||||||
| 		+0.5\cellwidth  | 		+0.5\cellwidth  | ||||||
| 		-0.5\wd\photobook@imagebox \relax}}% | 		-0.5\wd\photobook@imagebox \relax}}% | ||||||
| % left/right... | % left/right... | ||||||
| % shortdands... | % shortdands... | ||||||
| \newcommand\photobook@imagecell@LEFT{% | \newcommand\photobook@imagecell@LEFT{% | ||||||
| 	\def\photobook@imagecell@left{\dimexpr% | 	\def\photobook@imagecell@left{\dimexpr% | ||||||
| 		+\photobook@HOFFSETFIX | 		+\photobook@imagecell@clearance \relax}% | ||||||
| 		+\photobook@imagecell@clearance \relax}}% | 	\def\photobook@imagecell@captionleft{ | ||||||
| \newcommand\photobook@imagecell@RIGHT{% | 		% XXX not sure why this branch is needed... | ||||||
| 	\def\photobook@imagecell@left{\dimexpr  | 		\ifKV@imagecell@args@fit | ||||||
| 		+\photobook@HOFFSETFIX | 			0pt | ||||||
|  | 		\else% | ||||||
|  | 			\dimexpr% | ||||||
| 				+\cellwidth  | 				+\cellwidth  | ||||||
| 				-\photobook@imagecell@clearance | 				-\photobook@imagecell@clearance | ||||||
| 		-\wd\photobook@imagebox \relax}}% | 				-\wd\photobook@imagebox \relax\fi}}% | ||||||
|  | \newcommand\photobook@imagecell@RIGHT{% | ||||||
|  | 	\def\photobook@imagecell@left{\dimexpr  | ||||||
|  | 		+\cellwidth  | ||||||
|  | 		-\photobook@imagecell@clearance | ||||||
|  | 		-\wd\photobook@imagebox \relax} | ||||||
|  | 	% XXX not sure why 0.5 but it seems to work... | ||||||
|  | 	\def\photobook@imagecell@captionleft{% | ||||||
|  | 		-0.5\photobook@imagecell@left}}% | ||||||
| % args... | % args... | ||||||
| \define@boolkey{imagecell@args}{left}[true]{% | \define@boolkey{imagecell@args}{left}[true]{% | ||||||
| 	\photobook@imagecell@LEFT} | 	\photobook@imagecell@LEFT} | ||||||
| @ -1321,12 +1327,19 @@ | |||||||
| % top/bottom... | % top/bottom... | ||||||
| \define@boolkey{imagecell@args}{top}[true]{% | \define@boolkey{imagecell@args}{top}[true]{% | ||||||
| 	\def\photobook@imagecell@top{% | 	\def\photobook@imagecell@top{% | ||||||
| 		\photobook@imagecell@clearance}}% | 		\photobook@imagecell@clearance} | ||||||
|  | 	\def\photobook@imagecell@captiontop{ | ||||||
|  | 		-\dimexpr  | ||||||
|  | 			+\cellheight  | ||||||
|  | 			-\photobook@imagecell@clearance | ||||||
|  | 			-\ht\photobook@imagebox \relax}}% | ||||||
| \define@boolkey{imagecell@args}{bottom}[true]{% | \define@boolkey{imagecell@args}{bottom}[true]{% | ||||||
| 	\def\photobook@imagecell@top{\dimexpr  | 	\def\photobook@imagecell@top{\dimexpr  | ||||||
| 		+\cellheight  | 		+\cellheight  | ||||||
| 		-\photobook@imagecell@clearance | 		-\photobook@imagecell@clearance | ||||||
| 		-\ht\photobook@imagebox \relax}}% | 		-\ht\photobook@imagebox \relax} | ||||||
|  | 	\def\photobook@imagecell@captiontop{% | ||||||
|  | 		\photobook@imagecell@top}}% | ||||||
| % clearance=<len>... | % clearance=<len>... | ||||||
| \define@key{imagecell@args}{clearance}{% | \define@key{imagecell@args}{clearance}{% | ||||||
| 	\setlength\photobook@imagecell@clearance{#1}}% | 	\setlength\photobook@imagecell@clearance{#1}}% | ||||||
| @ -1335,9 +1348,6 @@ | |||||||
| \define@choicekey{imagecell@args}{caption-align}{t,c,b}[t]{% | \define@choicekey{imagecell@args}{caption-align}{t,c,b}[t]{% | ||||||
| 	\def\photobook@imagecell@captionalign{#1}}% | 	\def\photobook@imagecell@captionalign{#1}}% | ||||||
| 
 | 
 | ||||||
| % XXX can't seem to get rid of small placement errors... |  | ||||||
| %		...feels like we've still got a stray space someplace... |  | ||||||
| %		see: \photobook@HOFFSETFIX |  | ||||||
| % XXX can we make this an env??? | % XXX can we make this an env??? | ||||||
| \newcommand\imagecell[3][]{% | \newcommand\imagecell[3][]{% | ||||||
| 	\begingroup% | 	\begingroup% | ||||||
| @ -1378,28 +1388,23 @@ | |||||||
| 		% XXX for some odd reason without this the alignment completely breaks... | 		% XXX for some odd reason without this the alignment completely breaks... | ||||||
| 		\vspace{0pt}% | 		\vspace{0pt}% | ||||||
| 		\adjustbox{% | 		\adjustbox{% | ||||||
| 			margin= | 			margin={\photobook@imagecell@left} 0pt 0pt {\photobook@imagecell@top}}{% | ||||||
| 				{\photobook@imagecell@left - \photobook@HOFFSETFIX} |  | ||||||
| 				0pt 0pt  |  | ||||||
| 				{\photobook@imagecell@top}}{% |  | ||||||
| 			% image.... | 			% image.... | ||||||
| 			\usebox\photobook@imagebox% | 			\usebox\photobook@imagebox% | ||||||
| 			% caption cell... | 			% caption cell... | ||||||
| 			% XXX the \ifx here does not work... | 			% XXX do not do this if no caption is given...  | ||||||
| 			\ifx #2 \empty \else% |  | ||||||
| 			\begingroup% | 			\begingroup% | ||||||
| 					% XXX test for portrait images... |  | ||||||
| 				\hspace{-\mindim{% | 				\hspace{-\mindim{% | ||||||
| 							\wd\photobook@imagebox | 							\wd\photobook@imagebox | ||||||
| 						}{% | 						}{% | ||||||
| 								\cellwidth  | 							+\cellwidth  | ||||||
|  | 							-\photobook@imagecell@captionleft | ||||||
| 							-0.5\dimexpr  | 							-0.5\dimexpr  | ||||||
| 									\cellwidth  | 								+\cellwidth  | ||||||
| 								-\wd\photobook@imagebox \relax }}{% | 								-\wd\photobook@imagebox \relax }}{% | ||||||
| 					% prep for caption cell... | 					% prep for caption cell... | ||||||
| 						\setlength\cellwidth{\dimexpr% | 					\setlength\cellwidth{% | ||||||
| 							-2\photobook@HOFFSETFIX | 						\mindim{\wd\photobook@imagebox}{\cellwidth}}% | ||||||
| 							+\mindim{\wd\photobook@imagebox}{\cellwidth} \relax}% |  | ||||||
| 					\setlength\cellheight{% | 					\setlength\cellheight{% | ||||||
| 						\mindim{\ht\photobook@imagebox}{\cellheight}}%  | 						\mindim{\ht\photobook@imagebox}{\cellheight}}%  | ||||||
| 					\setlength\fboxsep{0pt}% | 					\setlength\fboxsep{0pt}% | ||||||
| @ -1408,13 +1413,14 @@ | |||||||
| 					\raisebox{-\mindim{% | 					\raisebox{-\mindim{% | ||||||
| 								0pt | 								0pt | ||||||
| 							}{% | 							}{% | ||||||
| 									0.5\dimexpr  | 								+ 0.5\dimexpr  | ||||||
| 										\cellheight  | 									+\cellheight  | ||||||
| 										-\ht\photobook@imagebox \relax}}{% | 									-\ht\photobook@imagebox  | ||||||
|  | 								-\photobook@imagecell@captiontop \relax}}{% | ||||||
| 						\begin{minipage}[b][\cellheight][\photobook@imagecell@captionalign]{\cellwidth}% | 						\begin{minipage}[b][\cellheight][\photobook@imagecell@captionalign]{\cellwidth}% | ||||||
| 							#2% | 							#2% | ||||||
| 						\end{minipage}}} | 						\end{minipage}}} | ||||||
| 				\endgroup\fi}% | 			\endgroup}% | ||||||
| 	\endgroup} | 	\endgroup} | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user