summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/gridset/gridset.dtx
blob: 68b251db558df8b5a03587c0dca79880973a03b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
% \iffalse meta-comment
%
% gridset.dtx
%
%% Copyright (C) 2008-2020 Markus Kohm
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3c
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%% http://www.latex-project.org/lppl.txt
%% and version 1.3c or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%%
%% This work has the LPPL maintenance status "maintained".
%%
%% The author and current maintainer of this work is
%% Markus Kohm <komascript@gmx.info>.
%%
%% This work consists of the files gridset.dtx and README.md.
%%
%% Important Recommendation:
%% The LPPL requires that distributions of the Work contain all the files of
%% the Work (see ``Important Recommendations'' at lppl.txt).
%%
%
%<*dtx>
\def\FmtName{LaTeX2e}
\ifx\FmtName\fmtname
  % Give me the package or the documentation
  \ifnum \catcode`\@=12\relax
    % Give me the documentation
    \ProvidesFile{gridset.dtx}
%</dtx>
%<*dtx|package|example>
%<package>\ProvidesPackage{gridset}
%<example>\ProvidesFile{gridsetexample.tex}
                 [2020-02-12 v0.3 grid - a.k.a. in-register - setting]
%</dtx|package|example>
%<*dtx>
    \documentclass{ltxdoc}
    \begin{document}
    \RecordChanges
    \GetFileInfo{gridset.dtx}
    \DocInput{gridset.dtx}
%</dtx>
%<*dtx>
    \expandafter\expandafter\expandafter\enddocument
  \fi
\else
  % Make the package
  \def\batchfile{gridset.dtx}
  \let\batchendinput\endinput
%</dtx>
%<*ins>
%<ins>\def\batchfile{gridset.ins}
  \input docstrip.tex

  \keepsilent
  \askforoverwritefalse
  \usedir{tex/latex/gridset}
  \preamble

IMPORTANT NOTE:

This is a generated file and you are not allowed to distribute it
without the source ot the work.  See below about more informations
about the files the work consists of.

\endpreamble

  \generate{%
    \file{gridset.ins}{\from{gridset.dtx}{ins}}%
    \file{gridset.sty}{\from{gridset.dtx}{package}}%
    \file{gridsetexample.tex}{\from{gridset.dtx}{example}}%
  }

  \ifToplevel{%
    \Msg{*********************************************************************}
    \Msg{*}
    \Msg{* gridset}
    \Msg{* =======}
    \Msg{*}
    \Msg{* THIS IS AN ALPHA VERSION!}
    \Msg{* DON'T USE IT ONLY TEST IT!}
    \Msg{*}
    \Msg{* To finish the installation run}
    \Msg{* \space\space latex gridset.dtx}
    \Msg{* or}
    \Msg{* \space\space pdflatex gridset.dtx}
    \Msg{* and then copy}
    \Msg{* \space\space gridset.sty to .../tex/latex/gridset/}
    \Msg{* \space\space gridset.dvi or gridset.pdf to .../doc/latex/gridset/}
    \Msg{* \space\space gridset.dtx and README to .../source/latex/gridset/}
    \Msg{* where .../ is your local TDS tree.}
    \Msg{* On some systems you'll get the local TDS tree using:}
    \Msg{* \space\space kpsewhich -var-value=TEXMFLOCAL}
    \Msg{*}
    \Msg{*********************************************************************}
  }

%</ins>
%<*dtx>
\fi
\csname fi\endcsname
\csname batchendinput\endcsname
%</dtx>
% \fi ^^A meta-comment
%
% \title{Semi-Manual Grid Setting Using \textsf{gridset}%
%   \footnote{This is an alpha version! Don't use it! Only test it! There's no
%     support and everything may change!}%
% }
% \author{Markus Kohm}
% \date{\filedate~\fileversion}
% \maketitle
% \begin{abstract}
%   Grid setting\,---\,also known as strict in-register setting\,---\,is
%   something, that should be done for a lot of documents but is not easy
%   using \LaTeX{}.  Package \textsf{gridset} helps to get the information
%   needed for grid setting.  It does not implement auto grid setting, but
%   there is a command \cs{vskipnextgrid}, that moves to the next grid
%   position.  This may be enough under some circumstances.  In other
%   circumstances it may fail.  So \textsf{gridset} is only one more step for
%   grid setting not a complete solution.
%
%   \paragraph*{Important Note:} This package should have been never released,
%   because it was only a very quick implementation of an idea. You should not
%   use it for any productive purpose. It has been made for testing only. I
%   would prefer to retire it from any distribution. Nevertheless I know few
%   persons using the package. So it will be still there but without any
%   support!
% \end{abstract}
% \tableofcontents
% \section{User Manual}
%
% \DescribeMacro{\gridinterval}%
% This macro contains a number without unit!  The number is the distance
% between two grid lines in unit `scale points' (sp).  You may set it so
% another value using, e.g.
% \begin{flushleft}
%  |\newlength{\|\meta{name of your length}|}|\\
%  |\setlength{\|\meta{name of your length}|}{|\meta{new length value}|}|\\
%  |\newcounter{\|\meta{name of your counter}|}|\\
%  |\setcounter{\|\meta{name of your counter}|}{\|\meta{name of your
%        length}|}|\\
%  |\edef\gridinterval{\|\meta{name of your length}|}|\\
% \end{flushleft}
%
% \DescribeMacro{\gridbase}%
% This macro contains an integer number, that represents the y-coordinate of
% the upper start of the grid.  If you want to change it, just save a position
% and \cs{edef} the \cs{gridbase} to the y-pos of that position.
%
% Most time you don't need to change \cs{gridinterval} and \cs{gridposition},
% because they are initialized to a base line grid at start of first page.
% Because of this, it doesn't matter, that changing them is not really user
% friendly.
%
% \DescribeMacro{\SavePos}%
% \DescribeMacro{\savepos}%
% \cs{SavePos}\marg{unique name} saves informations about the current position
% to the \texttt{aux}-file.  These informations are read at next \LaTeX{} run
% and may be used (see \cs{the\dots} commands below) then. The \meta{unique
% name} has to be a position name, that is unique for all saved position
% informations of the current document. Note that the command has been renamed
% from \cs{savepos} to \cs{SavePos} in release~0.2, because Lua\TeX{} since
% 0.85 uses \cs{savepos} as a new primitive. On other engines the old name
% \cs{savepos} is still available.
%
% \DescribeMacro{\vskipnextgrid}
% This command moves to the next grid position.  To achieve this, a position
% information is saved at this and used at next \LaTeX{} run.  The used name
% of the position information is \texttt{vb!\meta{number of
% skip}}. \meta{number of skip} is the number of the current
% \cs{vskipnextgrid} usage.  Counter \texttt{gridcnt} is used to number the
% usage of \cs{vskipnextgrid}.
%
% \DescribeMacro{\thegridinfo}
% \cs{thegridinfo}\marg{name} outputs
% \begin{itemize}
% \item arabic page number of the named position,
% \item grid base, that was valid saving the information of the named
%   position,
% \item grid interval, that was valid saving the information of the named
%   position,
% \item x-coordinate of the named position,
% \item y-coordinate of the named position.
% \end{itemize}
% The coordinates and intervals are numbers without units.  The unit is `scale
% points' (sp).
%
% \DescribeMacro{\theposinfo}
% \cs{theposinfo}\marg{name} outputs
% \begin{itemize}
% \item y-coordinate of the named position,
% \item grid line number (first is 0) of the next grid position,
% \item offset of the next grid position from grid base,
% \item distance to the next grid position.
% \end{itemize}
% The coordinates, offsets and distances are numbers without units.  The unit
% is `scale points' (sp).
%
% \DescribeMacro{\theypos}
% \cs{theypos}\marg{name} outputs the y-coordinate of the named position.
%
%
% \StopEventually{\PrintIndex\PrintChanges}
%
% \section{Implementation}
%
% \iffalse meta-comment
%<*package>
% \fi ^^A meta-comment
%
% \begin{macro}{gridset@luaorpdf}
% \changes{v0.2}{2017/06/05}{new internal because of Lua\TeX~0.85}
% \begin{macro}{\gridset@pageheight}
% \changes{v0.2}{2017/06/05}{new internal because of Lua\TeX~0.85}
% \begin{macro}{\gridset@pagewidth}
% \changes{v0.2}{2017/06/05}{new internal because of Lua\TeX~0.85}
% \begin{macro}{\gridset@savepos}
% \changes{v0.2}{2017/06/05}{new internal because of Lua\TeX~0.85}
% \begin{macro}{\gridset@lastxpos}
% \changes{v0.2}{2017/06/05}{new internal because of Lua\TeX~0.85}
% \begin{macro}{\gridset@lastypos}
% \changes{v0.2}{2017/06/05}{new internal because of Lua\TeX~0.85}
% We need some locals because Lua\TeX{} changed the names of several
% primitives inherited from PDF\TeX.
%    \begin{macrocode}
\newcommand*{\gridset@luaorpdf}[1]{%
  \expandafter\newcommand\csname gridset@#1\endcsname{}%
  \ifcsname pdf#1\endcsname
    \expandafter\let\csname gridset@#1\expandafter\endcsname
    \csname pdf#1\endcsname
  \else
    \ifcsname #1\endcsname
      \expandafter\let\csname gridset@#1\expandafter\endcsname
      \csname #1\endcsname
    \else
      \PackageError{gridset}{%
        neither \expandafter\string\csname #1\endcsname\space 
        nor \xpandafter\string\csname pdf#1\endcsname\space
        defined%
      }{This package needs either PDFTeX or LuaTeX or XeTeX.}%
    \fi
  \fi
}
\gridset@luaorpdf{pageheight}
\gridset@luaorpdf{pagewidth}
\gridset@luaorpdf{savepos}
\gridset@luaorpdf{lastxpos}
\gridset@luaorpdf{lastypos}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\gridbase}
% \changes{v0.2}{2017/06/05}{prepared for Lua\TeX~0.85}
% \begin{macro}{\gridinterval}
% \changes{v0.2}{2017/06/05}{prepared for Lua\TeX~0.85}
% These contain the grid information.  \cs{gridbase} is a integer number
% representing the absolute y coordinate of the upper end of the
% grid relative to the same reference point \cs{pdfsavepos}
% uses.  \cs{gridinterval} is a integer number representing the distance of
% two grid lines.  The unit is `scaled point' (sp) both time.
%    \begin{macrocode}
\newcommand*{\gridbase}{}
\newcommand*{\gridinterval}{}
%    \end{macrocode}
%   \cs{gridbase} and \cs{gridinterval} need to be initialized at the start of
%   the first page (fixme: shouldn't this be done at the start of every
%   page?).  We use this occasion to also initialize \cs{pdfpageheight} and
%   \cs{pdfpagewidth} if this hasn't been done already.
%    \begin{macrocode}
\AtBeginDocument{%
  \ifdim\gridset@pageheight=\z@
    \gridset@pageheight=\paperheight
  \fi
  \ifdim\gridset@pagewidth=\z@
    \gridset@pagewidth=\paperwidth
  \fi
  \begingroup
    \@tempdima=\dimexpr \gridset@pageheight - \topmargin - 1in 
                      - \headheight - \headsep 
                      - \topskip \relax
    \@tempcnta=\@tempdima
    \xdef\gridbase{\the\@tempcnta}%
    \@tempcnta=\baselineskip
    \xdef\gridinterval{\the\@tempcnta}%
  \endgroup
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\savepos}
% \changes{v0.2}{2017/06/05}{macro renamed}
% \begin{macro}{\SavePos}
% \changes{v0.2}{2017/06/05}{new name}
% \changes{v0.2}{2017/06/05}{prepared for Lua\TeX~0.85}
% Save current position on the page to the \texttt{aux}-file.  The argument
% is a unique name for the position.  The saved informations are:
% \begin{itemize}
% \item the name of the position,
% \item the arabic page number of the page with the position,
% \item the grid base, that was valid for this position,
% \item the grid interval, that was valid for this position,
% \item the x-coordinate of the absolute position,
% \item the y-coordinate of the absolute position.
% \end{itemize}
%    \begin{macrocode}
\newcommand*{\SavePos}[1]{%
  \begingroup
    \gridset@savepos
    \protected@write\@auxout{}{%
      \protect\newpos{#1}{\the\count\z@}{\gridbase}{\gridinterval}{%
        \noexpand\number\gridset@lastxpos
      }{%
        \noexpand\number\gridset@lastypos
      }%
    }%
  \endgroup
}
\ifx\savepos\gridset@savepos
  \PackageInfo{gridset}{LuaTeX detected.\MessageBreak
    Note, gridset command is \string\SavePos\MessageBreak
    but not \string\savepos, which is\MessageBreak
    a LuaTeX primitive
  }%
\else
  \PackageInfo{gridset}{\string\savepos\space defined as an alias of
    \string\SavePos}%
  \newcommand*{\savepos}{\SavePos}%
\fi
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\newpos}
%   This is the command, that has been written to the \texttt{aux}-file.
%   Reading the \texttt{aux}-file it defines several position dependant macros
%   to store the position information.  Reading the \texttt{aux}-file while
%   \cs{begin{document}} a double definition test is done.  Reading the
%   \texttt{aux}-file while \cs{end{document}} a test is done, if the position
%   has been changed and notes the user about needed additional \LaTeX{} runs.
%   (fixme: shouldn't the test be done with the x- and the y-coordinate
%   instead of the vskip only?)
%   The defined macros are:
%   \begin{description}
%   \item[\cs{pos@\meta{position name}@page}] the arabic page number of the
%     position
%   \item[\cs{pos@\meta{position name}@base}] the valid grid base while
%     saving the position
%   \item[\cs{pos@\meta{position name}@interval}] the valid grid interval
%     while saving the position
%   \item[\cs{pos@\meta{position name}@x}] the x-coordinate of the position
%   \item[\cs{pos@\meta{position name}@y}] the y-coordinate of the postion
%   \item[\cs{pos@\meta{position name}@line}] the number of the next grid line
%     for the position (first grid line has number 0)
%   \item[\cs{pos@\meta{position name}@offset}] distance of the next grid line
%     from the grid base
%   \item[\cs{pos@\meta{position name}@vskip}] distance to the next grid line
%     for the position
%   \end{description}
%   All values are integers. The unit to all values is `scaled points'
%   (sp). See \cs{pdfsavepos} at the pdf\TeX{} user manual for more
%   information.
%    \begin{macrocode}
\newcommand*{\newpos}[6]{%
  \grid@unique@test{#1}{#2}%
  \expandafter\global\@namedef{pos@#1@page}{#2}%
  \expandafter\global\@namedef{pos@#1@base}{#3}%
  \expandafter\global\@namedef{pos@#1@interval}{#4}%
  \expandafter\global\@namedef{pos@#1@x}{#5}%
  \expandafter\global\@namedef{pos@#1@y}{#6}%
  \begingroup
    \@tempcnta=\numexpr \@nameuse{pos@#1@base} - \@nameuse{pos@#1@y}\relax
    \@tempcnta=\numexpr \@tempcnta + \@nameuse{pos@#1@interval} - 1\relax
    \divide\@tempcnta by\@nameuse{pos@#1@interval}\relax
    \expandafter\xdef\csname pos@#1@line\endcsname{\the\@tempcnta}%
    \@tempcnta=\numexpr \@tempcnta * \@nameuse{pos@#1@interval}\relax
    \expandafter\xdef\csname pos@#1@offset\endcsname{\the\@tempcnta}%
    \@tempcnta=\numexpr \@nameuse{pos@#1@y} 
                      - ( \@nameuse{pos@#1@base} - \@tempcnta )\relax
    \expandafter\let\expandafter\@tempa\csname pos@#1@vskip\endcsname%
    \expandafter\xdef\csname pos@#1@vskip\endcsname{\the\@tempcnta}%
    \expandafter\ifx\csname pos@#1@vskip\endcsname\@tempa\else
      \grid@ReRunMessage
    \fi
  \endgroup
}
%    \end{macrocode}
% \begin{macro}{\grid@unique@test}
%   A very simple test to warn if a position name isn't unique.
%    \begin{macrocode}
\newcommand*{\grid@unique@test}[2]{%
  \expandafter\ifx\csname pos@#1@page\endcsname\relax\else
    \PackageError{gridset}{position `#1' is not unique.\@gobble}{%
      You have used the position name `#1' you are using on page
      `#2'\MessageBreak
      already on page `\csname pos@#1@page\endcsname'.\MessageBreak
      You should stop processing, remove the aux-files and correct the
      names.\MessageBreak
      If you'd continue, this will result in grid position
      failures,\MessageBreak
      that won't be reported!}%
  \fi
}
\AtBeginDocument{%
  \global\let\grid@unique@test\@gobble
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\grid@ReRunMessage}
%   The change test will be done for each \cs{newpos} but one user information
%   at the end of the document should be enough.  So we use a message macro,
%   that destroys itself after first usage.
%    \begin{macrocode}
\newcommand*\grid@ReRunMessage{}
\AtBeginDocument{%
  \renewcommand*\grid@ReRunMessage{%
    \PackageWarningNoLine{gridset}{Grid position labels may have
      changed.\MessageBreak
      Rerun to get grid positions right}%
    \global\let\grid@ReRunMessage\relax
  }%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\vskipnextgrid}
% \begin{macro}{gridcnt}
% Move to next grid position.  The counter \texttt{gridcnt} is used to give
% every move to position a unique position name.  The names are
% `\texttt{vp!\meta{number of the move to position}}'.  You may use this to
% get informations e.g. about the last move to position.
%    \begin{macrocode}
\newcounter{gridcnt}
\newcommand*{\vskipnextgrid}{%
  \begingroup
    \stepcounter{gridcnt}\edef\@tempa{vp!\thegridcnt}%
    \ifvmode
%    \end{macrocode}
% \cs{pdfsavepos} in vertical mode is a problem, because the base line
% alignment will be done at least at paragraph breaking.  Because of this,
% we have to leave the vertical mode and do it then.  But remark: If you
% change the base line skip e.g. changing the font size, the next line would
% not be grid aligned!
%    \begin{macrocode}
      \leavevmode\SavePos{\@tempa}%
      \expandafter\ifx\csname pos@\@tempa @vskip\endcsname\relax
      \else
        \expandafter\ifnum \csname pos@\@tempa @vskip\endcsname =\z@\else
          \PackageInfo{gridset}{%
            vmode \string\vskip\csname pos@\@tempa @vskip\endcsname sp%
          }%
          \vskip -\parskip\vskip -\baselineskip
          \expandafter\vskip\csname pos@\@tempa @vskip\endcsname sp\relax
        \fi
      \fi
    \else
%    \end{macrocode}
% \cs{pdfsavepos} in horizontal mode is a problem too, because we have to
% enter the vertical mode to do vertical skips. Because of this, the remark
% is  the same like the vertical mode remark.
%    \begin{macrocode}
      \parskip=\z@
      \SavePos{vp!\thegridcnt}%
      \expandafter\ifx\csname pos@\@tempa @vskip\endcsname\relax
      \else
        \expandafter\ifnum \csname pos@\@tempa @vskip\endcsname =\z@\else
          \PackageInfo{gridset}{%
            hmode \string\vskip\csname pos@\@tempa @vskip\endcsname sp%
          }%
          \vskip \dimexpr -\baselineskip
                          + \csname pos@\@tempa @vskip\endcsname sp\relax
%    \end{macrocode}
% \changes{v0.3}{2020/02/12}{support for twocolumn mode}
% In twocolumn mode we have to take care that in the second column we reduce
% the horizontal movement by the width of the first column plus the column
% separation.
% Note: This may fail, because the column information may be wrong
%       outside the output routine. Maybe we should add this information to
%       \cs{SavePos} or correct the x-pos there.
%    \begin{macrocode}
          \leavevmode
          \if@twoside
            \expandafter\ifodd\csname pos@\@tempa @page\endcsname\relax
              \hskip \dimexpr -1in - \oddsidemargin - \parindent
                            \if@twocolumn\if@firstcolumn\else
                              - \columnwidth - \columnsep
                            \fi\fi
                              + \csname pos@\@tempa @x\endcsname sp\relax
            \else
              \hskip \dimexpr -1in - \evensidemargin - \parindent
                            \if@twocolumn\if@firstcolumn\else
                              - \columnwidth - \columnsep
                            \fi\fi
                              + \csname pos@\@tempa @x\endcsname sp\relax
            \fi
          \else
            \hskip \dimexpr -1in - \oddsidemargin - \parindent 
                            \if@twocolumn\if@firstcolumn\else
                              - \columnwidth - \columnsep
                            \fi\fi
                            + \csname pos@\@tempa @x\endcsname sp\relax
          \fi
        \fi
      \fi
    \fi
  \endgroup
}
%    \end{macrocode}
%   (fixme: A better solution would be to first move and then set the
%   position.  But that solution needs some more tests and maybe some more
%   ideas, because after moving the position is on grid and so the saved x-pos
%   would be on grid.)
% \end{macro}
% \end{macro}
%
% \begin{macro}{\thegridinfo}
% \begin{macro}{\theposinfo}
% \begin{macro}{\theypos}
% Some informations about the grid (valid for a position) or the position.
%    \begin{macrocode}
\newcommand*{\thegridinfo}[1]{%
  page=\@nameuse{pos@#1@page},
  base=\@nameuse{pos@#1@base},
  interval=\@nameuse{pos@#1@interval},
  x=\@nameuse{pos@#1@x},
  y=\@nameuse{pos@#1@y}%
}
\newcommand*{\theposinfo}[1]{%
  y=\@nameuse{pos@#1@y},
  gridline=\@nameuse{pos@#1@line},
  gridoffset=\@nameuse{pos@#1@offset},
  movedown=\@nameuse{pos@#1@vskip}%
}
\newcommand*{\theypos}[1]{\@nameuse{pos@#1@y}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \iffalse meta-comment
%<*FALSE>
\csname endinput\endcsname
%</FALSE>
%</package>
% \fi
%
% \section{Example}
%
% You may try the following example document.  You have to do several \LaTeX{}
% runs until no new rerun warning occurs.
% \iffalse meta-comment
%<*example>
% \fi
%    \begin{macrocode}
\documentclass[a4paper,12pt]{article}
\usepackage{gridset}
\usepackage{blindtext}
\raggedbottom

\pagestyle{myheadings}

\begin{document}
\markright{gridbase=\gridbase, gridinterval=\gridinterval\ without move down}%
\newcounter{Zeile}%
\makeatletter
\@whilenum \value{Zeile}<40\do {%
  \stepcounter{Zeile}%
  \theZeile. Zeile:
  \SavePos{\thepage.\theZeile}\thegridinfo{\thepage.\theZeile}\par
}%
\makeatother
\clearpage
\setcounter{Zeile}{0}
\makeatletter
\@whilenum \value{Zeile}<20\do {%
  \stepcounter{Zeile}%
  \theZeile. Zeile:
  \SavePos{\thepage.\theZeile}\theposinfo{\thepage.\theZeile}\par 
}%
\makeatother
\clearpage
\parskip=.5\baselineskip
\setcounter{Zeile}{0}
\makeatletter
\@whilenum \value{Zeile}<20\do {%
  \stepcounter{Zeile}%
  \theZeile. Zeile:
  \SavePos{\thepage.\theZeile}\theposinfo{\thepage.\theZeile}\par 
}%
\makeatother
\clearpage
\markright{gridbase=\gridbase, gridinterval=\gridinterval\ with real move down
at vmode}%
\parskip=.5\baselineskip
\setcounter{Zeile}{0}
\makeatletter
\@whilenum \value{Zeile}<25\do {%
  \stepcounter{Zeile}%
  \vskipnextgrid\theZeile. Zeile: \theposinfo{vp!\thegridcnt}\par
}%
\makeatother
\clearpage
\markright{gridbase=\gridbase, gridinterval=\gridinterval\ with real move down
at hmode}%
\parskip=.5\baselineskip
\setcounter{Zeile}{0}
\makeatletter
\@whilenum \value{Zeile}<25\do {%
  \stepcounter{Zeile}%
  \theZeile. Zeile: \vskipnextgrid\theposinfo{vp!\thegridcnt}\par
}%
\makeatother
\clearpage
\parskip=0pt
\blindtext
\begin{itemize}
\item Test
\item Test
\end{itemize}
\vskipnextgrid\theposinfo{vp!\thegridcnt}\blindtext

\end{document}
%    \end{macrocode}
% \iffalse meta-comment
%</example>
% \fi
%
% \Finale
%
\endinput
%
% end of `gridset.dtx'
%
%%% Local Variables:
%%% mode: docTeX
%%% TeX-master: t
%%% End: