Skip to main content
english spelling...
Source Link
David Carlisle
  • 828.7k
  • 74
  • 1.7k
  • 2.6k

You can use the \pdfsavepos primitive (or its new name \savepos if you use the the latest luatex) to test the final typeset position.

theThe values are in sp from some reference point at the bottom of the page, you can just adjust by eye or usesuse something like

 \pdfsavepos\write20{here=\the\pdflastypos} 

at a reference point eg the first or last line of a page to get teh nymbersthe numbers to use as the bounds in \toptest and \bottest

As posted here it produces a log

Package mnote Warning: marginpar 1 very low on page 1. Package mnote Warning: marginpar 2 very high on page 2. \documentclass{article} \usepackage[textheight=8in,textwidth=4in]{geometry} \usepackage{lipsum} %\usepackage{ifthen} \newcounter{mpcount} \makeatletter \newcommand{\mnote}[2][0ex]{% \marginpar{\vspace{#1}% \begin{minipage}[c]{\marginparwidth} \stepcounter{mpcount}% \strut\pdfsavepos\write\@auxout{\string\toptest{\thempcount}{\thepage}{\the\pdflastypos}}% #2\ifhmode\unskip\fi \strut\pdfsavepos\write\@auxout{\string\bottest{\thempcount}{\thepage}{\the\pdflastypos}}% \end{minipage}% }} \def\toptest#1#2#3{\ifnum#3> 50000000 \PackageWarningNoLine{mnote}{marginpar #1 very high on page #2}% \fi} \def\bottest#1#2#3{\ifnum#3< 0 \PackageWarningNoLine{mnote}{marginpar #1 very low on page #2}% \fi} \makeatother \begin{document} \lipsum[1-4] A paragraph at the bottom of the page \mnote{\lipsum[5]} with a long note that goes too low on the page. \lipsum[6] A paragraph at the top of the page \mnote[-3in]{\lipsum[7]} where the note has been moved too high up. \end{document} 

You can use the \pdfsavepos primitive (or its new name \savepos if you use the the latest luatex) to test the final typeset position.

the values are in sp from some reference point at the bottom of the page, you can just adjust by eye or uses something like

 \pdfsavepos\write20{here=\the\pdflastypos} 

at a reference point eg the first or last line of a page to get teh nymbers to use as the bounds in \toptest and \bottest

As posted here it produces a log

Package mnote Warning: marginpar 1 very low on page 1. Package mnote Warning: marginpar 2 very high on page 2. \documentclass{article} \usepackage[textheight=8in,textwidth=4in]{geometry} \usepackage{lipsum} %\usepackage{ifthen} \newcounter{mpcount} \makeatletter \newcommand{\mnote}[2][0ex]{% \marginpar{\vspace{#1}% \begin{minipage}[c]{\marginparwidth} \stepcounter{mpcount}% \strut\pdfsavepos\write\@auxout{\string\toptest{\thempcount}{\thepage}{\the\pdflastypos}}% #2\ifhmode\unskip\fi \strut\pdfsavepos\write\@auxout{\string\bottest{\thempcount}{\thepage}{\the\pdflastypos}}% \end{minipage}% }} \def\toptest#1#2#3{\ifnum#3> 50000000 \PackageWarningNoLine{mnote}{marginpar #1 very high on page #2}% \fi} \def\bottest#1#2#3{\ifnum#3< 0 \PackageWarningNoLine{mnote}{marginpar #1 very low on page #2}% \fi} \makeatother \begin{document} \lipsum[1-4] A paragraph at the bottom of the page \mnote{\lipsum[5]} with a long note that goes too low on the page. \lipsum[6] A paragraph at the top of the page \mnote[-3in]{\lipsum[7]} where the note has been moved too high up. \end{document} 

You can use the \pdfsavepos primitive (or its new name \savepos if you use the the latest luatex) to test the final typeset position.

The values are in sp from some reference point at the bottom of the page, you can just adjust by eye or use something like

 \pdfsavepos\write20{here=\the\pdflastypos} 

at a reference point eg the first or last line of a page to get the numbers to use as the bounds in \toptest and \bottest

As posted here it produces a log

Package mnote Warning: marginpar 1 very low on page 1. Package mnote Warning: marginpar 2 very high on page 2. \documentclass{article} \usepackage[textheight=8in,textwidth=4in]{geometry} \usepackage{lipsum} %\usepackage{ifthen} \newcounter{mpcount} \makeatletter \newcommand{\mnote}[2][0ex]{% \marginpar{\vspace{#1}% \begin{minipage}[c]{\marginparwidth} \stepcounter{mpcount}% \strut\pdfsavepos\write\@auxout{\string\toptest{\thempcount}{\thepage}{\the\pdflastypos}}% #2\ifhmode\unskip\fi \strut\pdfsavepos\write\@auxout{\string\bottest{\thempcount}{\thepage}{\the\pdflastypos}}% \end{minipage}% }} \def\toptest#1#2#3{\ifnum#3> 50000000 \PackageWarningNoLine{mnote}{marginpar #1 very high on page #2}% \fi} \def\bottest#1#2#3{\ifnum#3< 0 \PackageWarningNoLine{mnote}{marginpar #1 very low on page #2}% \fi} \makeatother \begin{document} \lipsum[1-4] A paragraph at the bottom of the page \mnote{\lipsum[5]} with a long note that goes too low on the page. \lipsum[6] A paragraph at the top of the page \mnote[-3in]{\lipsum[7]} where the note has been moved too high up. \end{document} 
Source Link
David Carlisle
  • 828.7k
  • 74
  • 1.7k
  • 2.6k

You can use the \pdfsavepos primitive (or its new name \savepos if you use the the latest luatex) to test the final typeset position.

the values are in sp from some reference point at the bottom of the page, you can just adjust by eye or uses something like

 \pdfsavepos\write20{here=\the\pdflastypos} 

at a reference point eg the first or last line of a page to get teh nymbers to use as the bounds in \toptest and \bottest

As posted here it produces a log

Package mnote Warning: marginpar 1 very low on page 1. Package mnote Warning: marginpar 2 very high on page 2. \documentclass{article} \usepackage[textheight=8in,textwidth=4in]{geometry} \usepackage{lipsum} %\usepackage{ifthen} \newcounter{mpcount} \makeatletter \newcommand{\mnote}[2][0ex]{% \marginpar{\vspace{#1}% \begin{minipage}[c]{\marginparwidth} \stepcounter{mpcount}% \strut\pdfsavepos\write\@auxout{\string\toptest{\thempcount}{\thepage}{\the\pdflastypos}}% #2\ifhmode\unskip\fi \strut\pdfsavepos\write\@auxout{\string\bottest{\thempcount}{\thepage}{\the\pdflastypos}}% \end{minipage}% }} \def\toptest#1#2#3{\ifnum#3> 50000000 \PackageWarningNoLine{mnote}{marginpar #1 very high on page #2}% \fi} \def\bottest#1#2#3{\ifnum#3< 0 \PackageWarningNoLine{mnote}{marginpar #1 very low on page #2}% \fi} \makeatother \begin{document} \lipsum[1-4] A paragraph at the bottom of the page \mnote{\lipsum[5]} with a long note that goes too low on the page. \lipsum[6] A paragraph at the top of the page \mnote[-3in]{\lipsum[7]} where the note has been moved too high up. \end{document}