1

There is a small space between where visualize.lco (loaded with command \LoadLetterOption{visualize}) indicates is the top of the refline, and where text in the refline actually appears. How can I get rid of this?

Example:

\documentclass{scrlttr2}
\LoadLetterOption{visualize}

\setkomavar{date}{\fbox{11/01/2011}}

\showfields{address,refline}
\setshowstyle{edges}

\begin{document}
\begin{letter}{Dr.~Leo Lion\\Fordstan University}
  \opening{Dear Sir,}
  This is a test.
  \closing{Sincerely yours}
\end{letter}
\end{document}

example of what this code produces

  • It is to me, at least :) I was able to hack something together that involving changing the definition of the letter environment so that refvpos is toaddrvpos + the height of the toaddr area + 0.89\baselineskip but I don't know why 0.89. Would prefer a more sustainable, elegant, and informed solution. – Michael Hoffman Nov 2 '18 at 13:38
  • I upvoted your answer. But I want to exactly get rid of the actual space between refvpos and date, not change the way the visualization works. – Michael Hoffman Feb 9 '19 at 2:29
2

Well, in file visualize.lco you can find the definition of command \showfield@refline} to display the location of the used refline by edges or lines.

At the end of this definition you can find the command

\showfield{\useplength{refhpos}}{\useplength{refvpos}}%
          {\useplength{refwidth}}{-1.5\baselineskip}%

to display the location of the refline. To change the position in verticaly position you need to change the second parameter \useplength{refvpos} to for example 1.01\useplength{refvpos} ...

With the following MWE

\documentclass{scrlttr2}
\LoadLetterOption{visualize}
\showfields{address,refline}
\setshowstyle{edges}

\makeatletter
\renewcommand*{\showfield@refline}{%
  \begingroup
    \ifdim\useplength{refwidth}=\z@
      \if@refwide
        \@setplength{refwidth}{\paperwidth}%
        \ifdim \useplength{toaddrhpos}>\z@
          \@setplength{refhpos}{\useplength{toaddrhpos}}%
        \else
          \@setplength[-]{refhpos}{\useplength{toaddrhpos}}%
        \fi
        \@addtoplength[-2]{refwidth}{\useplength{refhpos}}%
      \else
        \@setplength{refwidth}{\textwidth}%
        \@setplength{refhpos}{\oddsidemargin}%
        \@addtoplength{refhpos}{1in}%
      \fi
    \else\ifdim\useplength{refhpos}=\z@
        \begingroup
          \setlength\@tempdima{\textwidth}%
          \addtolengthplength[-]{\@tempdima}{refwidth}%
          \setlength\@tempdimb{\oddsidemargin}%
          \addtolength\@tempdimb{1in}%
          \setlength{\@tempdimc}{\paperwidth}%
          \addtolength{\@tempdimc}{-\textwidth}%
          \divide\@tempdimb by 32768\relax
          \divide\@tempdimc by 32768\relax
          \ifdim\@tempdimc=\z@\else
            \multiply\@tempdima by\@tempdimb
            \divide\@tempdima by\@tempdimc
          \fi
          \edef\@tempa{\noexpand\endgroup
            \noexpand\@setplength{refhpos}{\the\@tempdima}}%
        \@tempa
    \fi\fi
    \showfield{\useplength{refhpos}}{1.01\useplength{refvpos}}% <=======
              {\useplength{refwidth}}{-1.5\baselineskip}%
  \endgroup
}
\makeatother


\setkomavar{date}{\fbox{11/01/2011 Qyf}}

%\setkomavar{myref}{201807/Q}
\setkomavar{subject}{Question}
\setkomavar{place}{Capital city}


\begin{document}
\begin{letter}{Dr.~Leo Lion\\Fordstan University}
  \opening{Dear Sir,}
  This is a test.
  \closing{Sincerely yours}
\end{letter}
\end{document}

you get the following result:

enter image description here

But at last I think it is not relevant, because the lines or edges to visualize the refline position are displayed without changing the position of the refline. It is only a visualisation and with a little distance between the lines/edges and your box the edges/lines can be seen better ...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.