scrttl2 - Position von Location verändern

Klassen und Pakete zur einfachen Umsetzung individueller Vorstellungen


Hannes Hegel
Forum-Anfänger
Forum-Anfänger
Beiträge: 46
Registriert: Mi 20. Jan 2016, 19:42

scrttl2 - Position von Location verändern

Beitrag von Hannes Hegel »

Hallo!

Ich versuche mich gerade an meiner ersten Briefvorlage mit Hilfe von scrttl2. Soweit bin ich auch schon recht zufrieden, aber natürlich gibt es immer etwas zu verbessern.
Ich möchte einige Daten aus der Kopfzeile in das Feld Location verschieben. Das funktioniert auch grundsätzlich, aber es gibt folgenden Haken: Das Feld ist viel weiter rechts als der Rest des Layouts:

Code: Alles auswählen

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Präamble
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[
    paper=a4,
    version=last,
    fontsize=11pt,
    DIV=15,
    parskip=half,
    pagenumber=bodcenter,
    pagestyle=headings,
    numericaldate=off,
    BCOR=0mm]{scrlttr2}

\KOMAoptions{
    foldmarks=true,
    locfield=wide
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Absenderdaten
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% allgemein
\setkomavar{backaddress}{Mitch Buchannon $\mid$ Strandboulevard 1 $\mid$ 90210 California}
\setkomavar{fromaddress}{Strandboulevard 1, 90210 California}

% geschäftlich
\setkomavar{fromname}{Mitch Buchannon \\ \footnotesize{Bademeister und Mauerstuerzer (FH)}}
\setkomavar{fromemail}[\Letter~]{BademeisterundMauerstuerzer@nichtschwimmer.de}
\setkomavar{fromphone}[\Mobilefone~]{+49\,176\,123 45 67}
\newkomavar[IBAN]{frkonto}
\setkomavar{frkonto}{DE30 9000 800 7654321}
\newkomavar[BIC]{frbank}
\setkomavar{frbank}{ABCDEFF}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Pakete allg.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{amsmath}
\usepackage{amssymb}

% Symbole: Handy, Telefon, E-Mail
\RequirePackage{marvosym}

\RequirePackage{graphics}

\RequirePackage{fontawesome}

\usepackage{ragged2e}
\usepackage{adjustbox}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Kopfzeile
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\firsthead{
    \adjustbox{valign=c}{
        \begin{minipage}{0.1\linewidth}
            \includegraphics[width=0.035\textheight]{example-image-a}
        \end{minipage}
    }
    \hspace{0.474\textwidth}
    \adjustbox{valign=c}{
        \begin{minipage}{0.4\linewidth}
        \begin{FlushRight}
        \LARGE{
            \usekomavar{fromname}\newline}
        \end{FlushRight}
        \end{minipage}
    }
        \vspace{0.15cm}
    \hrule
\hspace{0.6\textwidth}
    \adjustbox{valign=c}{
        \begin{minipage}{0.4\linewidth}
        \begin{FlushRight}
            \usekomavar{fromaddress}\\    
         \end{FlushRight}
        \end{minipage}
        }
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Location
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{array}
\setkomavar{location}{
  \begin{tabular}{@{ }r@{}}
    \usekomavar*{fromphone}\usekomavar{fromphone}\\
    \usekomavar*{fromemail}\usekomavar{fromemail}\\
    \usekomavar*{frkonto}\usekomavar{frkonto}\\
    \usekomavar*{frbank}\usekomavar{frbank}\\
  \end{tabular}
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[ngerman]{babel}
\usepackage{blindtext}
 \usepackage{graphicx}
 
% Definiere Grundschrift:
\usepackage[osf,sc]{mathpazo}

% Seitenlayout anpassen:
\usepackage{changepage}
\changepage{2cm}{}{}{}{}{}{}{}{-1.9cm}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Signatur
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\renewcommand*{\raggedsignature}{\raggedright}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Brief
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}

% Betreff, Datum, Ort:
\setkomavar{subject}{Betreff}
\setkomavar{date}{\today}

% Empfaenger:
\begin{letter}{
    Michael Ritter\\
    c/o Foundation\\
}

\opening{Lieber Michael,}

\blindtext

\closing{Mit freundlichem Gruß}
\setkomavar{signature}{\newline
\usekomavar{fromnname}\newline(CEO)
}

\encl{- A\\- B\\- C}

\end{letter}
\end{document}

Ich habe es auch schon mit einem anderen Code versucht:

Code: Alles auswählen

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Location
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\setkomavar{location}{
\begin{FlushRight}    
\usekomavar*{fromphone} \usekomavar{fromphone}\\
\usekomavar*{fromemail} \usekomavar{fromemail}\\
\usekomavar*{frkonto} \usekomavar{frkonto}\\
\usekomavar*{frbank} \usekomavar{frbank}\\
\end{FlushRight}                                % 
}        
aber auch das bringt mich leider nicht weiter. Mit kürzeren Werten für Email könnte ich das noch zurechtwurschteln, aber bei der IBAN hört es schon auf.

Gibt es eine bessere Möglichkeit, oder lässt sich das Feld als ganzes verschieben?

Gast

Beitrag von Gast »

Ich muss gleich weg, deshalb nur zwei Dinge:
  • Achte auf unerwünschte Leerzeichen.
  • Nahezu alle Felder auf dem Briefbogen lassen sich verschieben. Siehe dazu die Pseudolängen in Teil II der KOMA-Script-Anleitung. Bei dem location-Feld unbedingt auch die Erklärung im Text (nicht nur die Abbildung und Tabelle) beachten.

Hannes Hegel
Forum-Anfänger
Forum-Anfänger
Beiträge: 46
Registriert: Mi 20. Jan 2016, 19:42

Beitrag von Hannes Hegel »

Anonymous hat geschrieben:[*]Nahezu alle Felder auf dem Briefbogen lassen sich verschieben. Siehe dazu die Pseudolängen in Teil II der KOMA-Script-Anleitung. Bei dem location-Feld unbedingt auch die Erklärung im Text (nicht nur die Abbildung und Tabelle) beachten.[/list]
Vielen Dank!

Mit

Code: Alles auswählen

\makeatletter
\@setplength{locwidth}{6cm}
\makeatother
bekomme ich es jetzt schon da hin, wo es sein soll. Gibt es auch eine automatische Lösung, statt den Versatz manuell einzugeben?

esdd
Forum-Meister
Forum-Meister
Beiträge: 2481
Registriert: So 7. Feb 2010, 16:36

Beitrag von esdd »

Um Dir Position und Größe von beispielsweise dem Adressfeld und der Absenderergänzung anzeigen zu lassen, kannst Du

Code: Alles auswählen

\LoadLetterOption{visualize}% zum Anzeigen von Feldpositionen auf dem Briefbogen
\showfields{location,address}
in der Präambel ergänzen. Durch das Laden des Pakets showframe lässt sich außerdem das Seitenlayout für die Folgeseiten anzeigen. Dann sieht man, dass Deine Seitenlayoutanpassungen eher ungünstig sind. Die Seitenzahl im Fuß ist viel zu dicht am Textkörper.

Falls Du Adresse und Absenderergänzung bündig mit dem Textbereich ausrichten willst, kannst Du

Code: Alles auswählen

\setplength{toaddrhpos}{1in}
\addtoplength{toaddrhpos}{\oddsidemargin}
in der Präambel verwenden.

Deine Angaben in der Absenderergänzung musst Du zum einen rechtsbündig ausrichten. Wenn Du die Breite der Absenderergänzung nicht manuell vergrößern willst, kannst Du auch die Breite Deiner Angaben "verstecken". Allerdings bist Du dann auch selbst dafür verantwortlich, dass sie nicht bis ins Adressfeld ragen, was sie in Deinem Beispiel tun, und damit vielleicht im Fenster eines Briefumschlages auftauchen.

In Deinem Beispiel ist noch eine unbekannte Option, die veraltete Anweisung \firsthead und etliches andere. Zum Beispiel sind Schriftanweisungen wie \footnotesize Schalter und haben kein Argument.

Code: Alles auswählen

\documentclass[
  %paper=a4,% default
  %version=last,% default
  fontsize=11pt,
  DIV=15,
  parskip=half,
  %pagenumber=bodcenter,% meinst Du botcenter? botcenter ist default.
  %pagestyle=headings,% unbekannte Option.
  numericaldate=off,
  BCOR=0mm,
  %foldmarks=true,% default
  locfield=wide
]{scrlttr2}
%\pagestyle{headings}% falls Seitenstil headings gewünscht

% Anzeigen 
\usepackage{showframe}% zum Anzeigen der Seitenaufteilung
\LoadLetterOption{visualize}% zum Anzeigen von Feldpositionen auf dem Briefbogen
\showfields{location,address}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Absenderdaten
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% allgemein
\setkomavar{backaddress}{Mitch Buchannon $\mid$ Strandboulevard 1 $\mid$ 90210 California}
\setkomavar{fromaddress}{Strandboulevard 1, 90210 California}

% geschäftlich
\setkomavar{fromname}{Mitch Buchannon \\ \footnotesize Bademeister und Mauerstuerzer (FH)}
\setkomavar{fromemail}[\Letter~]{BademeisterundMauerstuerzer@nichtschwimmer.de}
\setkomavar{fromphone}[\Mobilefone~]{+49\,176\,123 45 67}
\newkomavar[IBAN]{frkonto}
\setkomavar{frkonto}{DE30 9000 800 7654321}
\newkomavar[BIC]{frbank}
\setkomavar{frbank}{ABCDEFF}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Pakete allg.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{amsmath}
\usepackage{amssymb}

% Symbole: Handy, Telefon, E-Mail
\usepackage{marvosym}% \usepackage statt \RequirePackage
\usepackage{graphics}% \usepackage statt \RequirePackage
%\usepackage{fontawesome}% \usepackage statt \RequirePackage
\usepackage{ragged2e}
%\usepackage{adjustbox}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Kopfzeile
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\setkomavar{firsthead}{% \setkomavar{firsthead}{...} statt dem veralteten \firsthead{...}
  \begin{minipage}{0.1\linewidth}
    \includegraphics[width=0.035\textheight]{example-image-a}
  \end{minipage}%
  \hfill
  \begin{minipage}{0.4\linewidth}
    \raggedleft\LARGE
    \usekomavar{fromname}
  \end{minipage}%
  \vspace{0.15cm}
  \hrule
  \hfill
  \usekomavar{fromaddress}
}

% horizontale Position des Adressbereiches und der Absenderergänzung am Textkörper ausrichten
\setplength{toaddrhpos}{1in}
\addtoplength{toaddrhpos}{\oddsidemargin}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Location
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{array}
\setkomavar{location}{%
  \raggedleft
  \makebox[0pt][r]{% "versteckt" die Breite der Tabelle und richtet die Tabelle rechts aus
    \begin{tabular}{@{ }r@{}}
      \usekomavar*{fromphone}\usekomavar{fromphone}\\
      \usekomavar*{fromemail}\usekomavar{fromemail}\\
      \usekomavar*{frkonto}\usekomavar{frkonto}\\
      \usekomavar*{frbank}\usekomavar{frbank}\\
    \end{tabular}%
}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[ngerman]{babel}
\usepackage{blindtext}
 \usepackage{graphicx}
 
% Definiere Grundschrift:
\usepackage[osf,sc]{mathpazo}

% Seitenlayout anpassen:
\usepackage{changepage}
\changepage{2cm}{}{}{}{}{}{}{}{-1.9cm}% <- Achtung: Fuß klebt an Textbereich

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Signatur
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\renewcommand*{\raggedsignature}{\raggedright}
\setkomavar{signature}{% Änderungen nach \closing haben keinen Effekt mehr
  \newline
  \usekomavar{fromname}% Tippfehler beseitigt
  \newline
  (CEO)
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Brief
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}

% Betreff, Datum, Ort:
\setkomavar{subject}{Betreff}
%\setkomavar{date}{\today}% default

% Empfaenger:
\begin{letter}{
    Michael Ritter\\
    c/o Foundation\\
}

\opening{Lieber Michael,}

\Blindtext
\vspace{2.2cm}
\Blindtext

\closing{Mit freundlichem Gruß}

\encl{- A\\- B\\- C}

\end{letter}
\end{document}
Vermutlich wären da noch weitere Änderungen sinnvoll. So sind der Zeilenumbruch und die Schriftänderung in der Variable fromname eher ungeschickt.

Hinweis: \setplength und \addtoplength sind erst ab KOMA-Script Version 3.26 verfügbar. Mit älteren Versionen müssen statt dessen \@setplength und \@addtoplength genutzt werden.[/code]

Antworten