3

I want to send a g-brief2 based letter with a very long address that does not fit the address window. The address is automatically hyphenated, which looks strange in this particular case.

Does anybody know how I can make the address window bigger without changing the rest of the structure of g-brief2?

MWE:

%% LyX 2.0.0 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[12pt,german]{g-brief2}
\usepackage{mathpazo}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\pagestyle{empty}
\setlength{\parskip}{\medskipamount}
\setlength{\parindent}{0pt}

\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands.
 \newcommand{\LyxGruss}[1]
   { \Gruss{#1}{0.5cm} }

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\fenstermarken % prints address window marks
\faltmarken % prints folding marks
%\lochermarke % prints puncher marks 
\trennlinien % prints striplines
%\unserzeichen % prints "our ref" instead of "my ref"



\makeatother

\usepackage{babel}
\begin{document}


\Adresse{
{\large Prof. Dr. X Y}\\
{\large Humongously long address. Seriously, it's that long!}\\
}


\Datum{\today}


\Betreff{Address shortening}


\Anrede{Dear Prof Y,}


\LyxGruss{Best regards,}


\Unterschrift{j}

\begin{g-brief}
Please shorten your address!
\end{g-brief}

\end{document}
0

1 Answer 1

2

Since you're using LyX, I assume you're after a Document > Settings... > LaTeX Preamble solution. Original output:

enter image description here

  1. You can either set the address using \raggedright by adding the following to your LaTeX Preamble:

    \def\Adresse#1{\def\adresse{\raggedright#1}}
    

    This allows content within the \Adresse field to wrap without hyphenation.

    enter image description here

  2. You can stretch the 3in width \parbox that holds the address to (say) 6in:

    \usepackage{etoolbox}% http://ctan.org/pkg/regexpatch
    
    \def\fenstermerken@{%
          \put(-9,-18.15){\line( 1, 0){1}} \put(-9,-18.15){\line( 0,-1){1}}%
          \put(126,-18.15){\line(-1, 0){1}} \put(126,-18.15){\line( 0,-1){1}}%
          \put(-9,-61.00){\line( 1, 0){1}} \put(-9,-61.00){\line( 0, 1){1}}%
          \put(126,-61.00){\line(-1, 0){1}} \put(126,-61.00){\line( 0, 1){1}}%
    }
    % \patchcmd{<cmd>}{<search>}{<replace>}{<success>}{<failure>}
    \patchcmd{\ps@firstpage}{3in}{6in}{}{}% Adjust width of address box
    \patchcmd{\ps@firstpage}{{85}}{{135}}{}{}% Increase horizontal rule
    \patchcmd{\ps@firstpage}{\iffenstermarken}{\fenstermerken@\fenstermarkenfalse\iffenstermarken}{}{}% Top/bottom right corners of address box
    

    The above etoolbox patches does 3 things:

    • Increase the width of the \parbox;
    • Increase the horizontal rule above the address; and
    • Move the right-hand top/bottom fenster marken.

    enter image description here

    For something shorter than 6in, you'll have to fiddle with the numbers 135 and (126 in \fenstermarken@, or 9 less than whatever you choose for 135)


g-brief2 is not that flexible.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .