TeX - LaTeX Asked on June 26, 2021
In the code below, the rulers are positioned where I want them to be, that is 19pt to the left/above the body. But I would like 0, on each of the h and v rulers, to coincide with the top-left corner of the body. fgrulerstartnumh{-19pt}
seemed like the way to do it, but it only accepts positive integers. OTOH, if I use the []commented[-out] usepackage
instruction, I get the second requirement, but not the first. Is there a way out of this dilemma?
documentclass{article}
usepackage[showframe]{geometry}
usepackage[type=none]{fgruler}
%usepackage[type=upperleftT,unit=in]{fgruler}
usepackage{xparse}
%https://tex.stackexchange.com/questions/588521/shifting-the-starting-number-of-a-ruler-such-that-0-aligns-with-the-top-left-cor
ExplSyntaxOn
makeatletter
% Adapted from:
% https://tex.stackexchange.com/questions/201488/how-to-get-the-active-left-and-right-margins-to-use-them-in-a-tikzpicture
dim_new:N erw_Gmlmargin_dim
dim_set:Nn erw_Gmlmargin_dim{dimexprGm@lmargin}
dim_new:N erw_Gmtmargin_dim
dim_set:Nn erw_Gmtmargin_dim{dimexprGm@tmargin}
makeatother
ExplSyntaxOff
begin{document}
ExplSyntaxOn
noindent
verb|erw_Gmlmargin_dim|~
dim_use:Nerw_Gmlmargin_dim;~
verb|erw_Gmtmargin_dim|:~dim_use:Nerw_Gmtmargin_dim.par
%dim_new:N erw_hstart_dim
%dim_set:Nnerw_hstart_dim{dim_eval:n{-1 * 19pt}} % ERROR
dim_zero_new:N erw_hstart_dim
dim_sub:Nnerw_hstart_dim{19pt} % Workaround
noindent{}verb|erw_hstart_dim|~dim_use:Nerw_hstart_dim;~
dim_zero_new:N erw_vstart_dim
dim_sub:Nnerw_vstart_dim{19pt}
noindent{}verb|erw_vstart_dim|~dim_use:Nerw_vstart_dim.par
dim_new:N erw_hshift_dim
dim_set:Nn erw_hshift_dim{erw_Gmlmargin_dim}
dim_add:Nn erw_hshift_dim{erw_hstart_dim}
noindent{}verb|erw_hshift_dim|~dim_use:Nerw_hshift_dim;~
dim_new:N erw_vshift_dim
dim_set:Nn erw_vshift_dim{erw_Gmtmargin_dim}
dim_add:Nn erw_vshift_dim{erw_hstart_dim}
noindent{}verb|erw_vshift_dim|~dim_use:Nerw_vshift_dim;~
% fgrulerstartnumh{erw_hstart_dim}
% fgrulerstartnum{〈num〉}
% The〈num〉is a nonnegative integer, which will be the starting number on the horizontal and verticalrulers. Default:fgrulerstartnum{0}
fgruler[in]{upperleft}
{erw_hshift_dim}
{erw_vshift_dim}
ExplSyntaxOff
end{document}
Maybe that's right for you:
documentclass{article}
usepackage{lipsum}
usepackage[type=user,unit=in,showframe,color=red]{fgruler}
fgrulerdefuserin{
rulerparamsfromfg
AtTextLowerLeft{%
rulernorotatenum
fgrulercaptionin{}
hspace{-5pt}llap{ruler[in]{downright}{textheight}}}
AtTextUpperLeft{%
lower-5pthbox{ruler[in]{rightdown}{textwidth}}}}
begin{document}
lipsum
end{document}
Correct answer by hair-splitter on June 26, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP