Drawing grid lines to show vertical position of text
up vote
1
down vote
favorite
I have text where I want to adjust the space above the first line. I want to overlay grid lines to show where the vertical position of the text is.
The MWE below with the following line commented is the standard output. The red horizontal lines are integer multiples of baselineskip
from the top.
%defIncludeDesiredTopSkip{}
However, if I uncomment this line (which applies the DesiredTopSkip
, which is set to 0pt
here), I obtain the following:
defIncludeDesiredTopSkip{}
Note that the baseline now is exactly on the line.
Question:
What am I missing that would explain this discrepancy in the two cases and how do I get both cases to properly display the baseline?
Note:
- In case anyone is curious as to why I want to do this: These lines are then used to compute the
parshape
parameters based on where these lines intersect the particular shape.
References:
Why does vspace*{0pt} add vertical space?.
Confused with TeX terminology: height, depth, width
Code:
%defIncludeDesiredTopSkip{}
documentclass{article}
usepackage{showframe}
usepackage{tikz}
usepackage[paperwidth=7.0cm]{geometry}
newcommand*{DesiredTopSkip}{0pt}
newcommand*{ShowTextGuideLines}[1]{%
begin{tikzpicture}[remember picture, overlay]
coordinate (X) at ([
xshift=1.0in+hoffset+oddsidemargin,
yshift=-1.0in-voffset-topmargin-headheight-headsep%
]current page.north west);
node [draw=red, fill=yellow] at (X) {X};%% DEBUGGING: Ensure (X) is the correct spot.
foreach X in {1, ..., #1} {%
draw [thin, red] ([yshift=-Xbaselineskip-DesiredTopSkip]X) -- ++ (hsize,0);
}%
end{tikzpicture}%
}%
begin{document}
ifdefinedIncludeDesiredTopSkip
%% See comments in https://tex.stackexchange.com/q/7676/4301
hbox{}kern-topskip%
vspace*{DesiredTopSkip}%
fi
First line. abcdefghij
par
Second line. abcdefghij
ShowTextGuideLines{3}
end{document}
spacing vertical-alignment boxes dimensions
add a comment |
up vote
1
down vote
favorite
I have text where I want to adjust the space above the first line. I want to overlay grid lines to show where the vertical position of the text is.
The MWE below with the following line commented is the standard output. The red horizontal lines are integer multiples of baselineskip
from the top.
%defIncludeDesiredTopSkip{}
However, if I uncomment this line (which applies the DesiredTopSkip
, which is set to 0pt
here), I obtain the following:
defIncludeDesiredTopSkip{}
Note that the baseline now is exactly on the line.
Question:
What am I missing that would explain this discrepancy in the two cases and how do I get both cases to properly display the baseline?
Note:
- In case anyone is curious as to why I want to do this: These lines are then used to compute the
parshape
parameters based on where these lines intersect the particular shape.
References:
Why does vspace*{0pt} add vertical space?.
Confused with TeX terminology: height, depth, width
Code:
%defIncludeDesiredTopSkip{}
documentclass{article}
usepackage{showframe}
usepackage{tikz}
usepackage[paperwidth=7.0cm]{geometry}
newcommand*{DesiredTopSkip}{0pt}
newcommand*{ShowTextGuideLines}[1]{%
begin{tikzpicture}[remember picture, overlay]
coordinate (X) at ([
xshift=1.0in+hoffset+oddsidemargin,
yshift=-1.0in-voffset-topmargin-headheight-headsep%
]current page.north west);
node [draw=red, fill=yellow] at (X) {X};%% DEBUGGING: Ensure (X) is the correct spot.
foreach X in {1, ..., #1} {%
draw [thin, red] ([yshift=-Xbaselineskip-DesiredTopSkip]X) -- ++ (hsize,0);
}%
end{tikzpicture}%
}%
begin{document}
ifdefinedIncludeDesiredTopSkip
%% See comments in https://tex.stackexchange.com/q/7676/4301
hbox{}kern-topskip%
vspace*{DesiredTopSkip}%
fi
First line. abcdefghij
par
Second line. abcdefghij
ShowTextGuideLines{3}
end{document}
spacing vertical-alignment boxes dimensions
But you already know that the problem is topskip: The first line is not at a distance of baselineskip (12pt) from the x but of topskip (10pt if there is nothing large in the line).
– Ulrike Fischer
38 mins ago
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I have text where I want to adjust the space above the first line. I want to overlay grid lines to show where the vertical position of the text is.
The MWE below with the following line commented is the standard output. The red horizontal lines are integer multiples of baselineskip
from the top.
%defIncludeDesiredTopSkip{}
However, if I uncomment this line (which applies the DesiredTopSkip
, which is set to 0pt
here), I obtain the following:
defIncludeDesiredTopSkip{}
Note that the baseline now is exactly on the line.
Question:
What am I missing that would explain this discrepancy in the two cases and how do I get both cases to properly display the baseline?
Note:
- In case anyone is curious as to why I want to do this: These lines are then used to compute the
parshape
parameters based on where these lines intersect the particular shape.
References:
Why does vspace*{0pt} add vertical space?.
Confused with TeX terminology: height, depth, width
Code:
%defIncludeDesiredTopSkip{}
documentclass{article}
usepackage{showframe}
usepackage{tikz}
usepackage[paperwidth=7.0cm]{geometry}
newcommand*{DesiredTopSkip}{0pt}
newcommand*{ShowTextGuideLines}[1]{%
begin{tikzpicture}[remember picture, overlay]
coordinate (X) at ([
xshift=1.0in+hoffset+oddsidemargin,
yshift=-1.0in-voffset-topmargin-headheight-headsep%
]current page.north west);
node [draw=red, fill=yellow] at (X) {X};%% DEBUGGING: Ensure (X) is the correct spot.
foreach X in {1, ..., #1} {%
draw [thin, red] ([yshift=-Xbaselineskip-DesiredTopSkip]X) -- ++ (hsize,0);
}%
end{tikzpicture}%
}%
begin{document}
ifdefinedIncludeDesiredTopSkip
%% See comments in https://tex.stackexchange.com/q/7676/4301
hbox{}kern-topskip%
vspace*{DesiredTopSkip}%
fi
First line. abcdefghij
par
Second line. abcdefghij
ShowTextGuideLines{3}
end{document}
spacing vertical-alignment boxes dimensions
I have text where I want to adjust the space above the first line. I want to overlay grid lines to show where the vertical position of the text is.
The MWE below with the following line commented is the standard output. The red horizontal lines are integer multiples of baselineskip
from the top.
%defIncludeDesiredTopSkip{}
However, if I uncomment this line (which applies the DesiredTopSkip
, which is set to 0pt
here), I obtain the following:
defIncludeDesiredTopSkip{}
Note that the baseline now is exactly on the line.
Question:
What am I missing that would explain this discrepancy in the two cases and how do I get both cases to properly display the baseline?
Note:
- In case anyone is curious as to why I want to do this: These lines are then used to compute the
parshape
parameters based on where these lines intersect the particular shape.
References:
Why does vspace*{0pt} add vertical space?.
Confused with TeX terminology: height, depth, width
Code:
%defIncludeDesiredTopSkip{}
documentclass{article}
usepackage{showframe}
usepackage{tikz}
usepackage[paperwidth=7.0cm]{geometry}
newcommand*{DesiredTopSkip}{0pt}
newcommand*{ShowTextGuideLines}[1]{%
begin{tikzpicture}[remember picture, overlay]
coordinate (X) at ([
xshift=1.0in+hoffset+oddsidemargin,
yshift=-1.0in-voffset-topmargin-headheight-headsep%
]current page.north west);
node [draw=red, fill=yellow] at (X) {X};%% DEBUGGING: Ensure (X) is the correct spot.
foreach X in {1, ..., #1} {%
draw [thin, red] ([yshift=-Xbaselineskip-DesiredTopSkip]X) -- ++ (hsize,0);
}%
end{tikzpicture}%
}%
begin{document}
ifdefinedIncludeDesiredTopSkip
%% See comments in https://tex.stackexchange.com/q/7676/4301
hbox{}kern-topskip%
vspace*{DesiredTopSkip}%
fi
First line. abcdefghij
par
Second line. abcdefghij
ShowTextGuideLines{3}
end{document}
spacing vertical-alignment boxes dimensions
spacing vertical-alignment boxes dimensions
asked 1 hour ago
Peter Grill
163k24432740
163k24432740
But you already know that the problem is topskip: The first line is not at a distance of baselineskip (12pt) from the x but of topskip (10pt if there is nothing large in the line).
– Ulrike Fischer
38 mins ago
add a comment |
But you already know that the problem is topskip: The first line is not at a distance of baselineskip (12pt) from the x but of topskip (10pt if there is nothing large in the line).
– Ulrike Fischer
38 mins ago
But you already know that the problem is topskip: The first line is not at a distance of baselineskip (12pt) from the x but of topskip (10pt if there is nothing large in the line).
– Ulrike Fischer
38 mins ago
But you already know that the problem is topskip: The first line is not at a distance of baselineskip (12pt) from the x but of topskip (10pt if there is nothing large in the line).
– Ulrike Fischer
38 mins ago
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f461069%2fdrawing-grid-lines-to-show-vertical-position-of-text%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
But you already know that the problem is topskip: The first line is not at a distance of baselineskip (12pt) from the x but of topskip (10pt if there is nothing large in the line).
– Ulrike Fischer
38 mins ago