I am scratching a custom invoice template based on scrlttr2 from the KOMA-Script and example code provided by Markus Kohm (specifically, the files asymTypB.lco and briefwbk.tex to be found under KOMA-Script-3/Anhang-E/source).
In the quest to retouch the design and fit, as well, various information inside the right positioned Info-Block, I would like to right-align (flushright or \raggedleft? Are they identical?) the entries \usekomavar{date}, \usekomavar{place} and \usekomavar{frombank}. As almost everything seems to work-out quite nice, instructing \raggedleft for the variables in question, they are hooked to the edge of the A4-sized paper.
.
The code in question that derives this result is sourced from a custom version of the asymTypB.lco file:
% Main block of Info-Column
\put(0,0){\parbox[t]{\useplength{infocolwidth}}{%
\raggedleft%
\vspace{\useplength{refvpos}}%
\vspace{\useplength{refaftervskip}}%
\usekomavar{date}\\%
\usekomavar{place}\\[9\baselineskip]%
%
\raggedright%
\usekomavar{fromname}\\[\baselineskip]%
\ifkomavarempty{company}{}{%
\\
\usekomavar{company}%
}~\\%
\usekomavar{professiona}\\[\baselineskip]%
\usekomavar{professionb}\\[2\baselineskip]%
\usekomavar{fromaddress}\\[\baselineskip]%
\usekomavar*{fromphone}\usekomavar{fromphone}\\[\baselineskip]%
\ifkomavarempty{fromfax}{}{%
\\
\usekomavar*{fromfax}\usekomavar{fromfax}%
}%
\usekomavar{fromemail}\\[\baselineskip]%
%\usekomavar{fromurl}\\%
\usekomavar{fromlinkedin}\\[2\baselineskip]%
\usekomavar{fromvatin}\\%
}%
}%
% Banking information
\put(0,0){\parbox[t]{\useplength{infocolwidth}}{%
\raggedleft
\vspace{\useplength{firstfootvpos}}%
\vspace{-\footskip}%
\usekomavar{frombank}%
}%
}%
\end{picture}%
\hspace*{\useplength{infocolwidth}}%
What I am after is to get the lengthiest entry in the info-block (i.e. the LinkedIn entry currently) and use its distance to the edge of the paper as a margin for date, place and frombank so as to align them in the virtual right border of the info-block.
The infocolwidth is defined in the same .lco file by \@setplength{infocolwidth}{.2.5\paperwidth}.
How can I make this look nice? Besides, although I've read https://tex.stackexchange.com/a/4692/8272 and https://tex.stackexchange.com/a/7459/8272, I still can't fix all of the "There's no line here to end" \opening{text} errors.
Update Files for a (not exactly) Minimal Working Example attached.
custom_AsymTypB.lco
% Custom Template for an Inoice (Letter)
% Based on:
% asymTypB.lco
% Copyright 2008 Markus Kohm
% Metadata about this file
\ProvidesFile{asymTypB.lco}%
[2011/09/20 v0.2 unsupported LCO-file]%
% DIN 676 B
\LoadLetterOption{DINmtext}%
% Place letter body to the left
\setlength{\oddsidemargin}{\useplength{toaddrhpos}}%
\addtolength{\oddsidemargin}{-1in}%
% Again... ?
\AfterCalculatingTypearea{%
\setlength{\oddsidemargin}{\useplength{toaddrhpos}}%
\addtolength{\oddsidemargin}{-1in}%
}%
\activateareas
% Head
\@setplength{firstheadvpos}{0pt}%
\@setplength{firstheadwidth}{\paperwidth}%
% Foot
\@setplength{firstfootvpos}{\paperheight}%
\@addtoplength[-]{firstfootvpos}{\useplength{toaddrvpos}}%
% Reference
\@addtoplength{refvpos}{-1.5\baselineskip}%
% New variable(s) here!
\newkomavar{company}%
\newkomavar{professiona}%
\newkomavar{professionb}%
\newkomavar[VATin]{fromvatin}%
\newkomavar{fromlinkedin}%
% New variables that concern the client here!
% \newkomavar*[Your VATin]{yourvatin}%
% Set pseudo-length for infocol
\@newplength{infocolwidth}%
\ifdim \textwidth<0.666\paperwidth% How is this supposed to work?
\@setplength{infocolwidth}{.22222\paperwidth}%
\else
\@setplength{infocolwidth}{.2.5\paperwidth}%{0.1667\paperwidth}%
\fi
% Set Head first... ?
\setkomavar{firsthead}{%
\fontsize{8}{9}\sffamily% Font size(s)
\hspace*{\fill}%
\begin{picture}(0,0)%
% Logo?
\put(0,0){\parbox[t]{\useplength{infocolwidth}}{%
\vspace{\useplength{toaddrvpos}}%
\usekomavar{fromlogo}%
}%
}%
% Main block of Info-Column
\put(0,0){\parbox[t]{\useplength{infocolwidth}}{%
\flushright%
\vspace{\useplength{refvpos}}%
\vspace{\useplength{refaftervskip}}%
\usekomavar{date}\\%
\usekomavar{place}\\[9\baselineskip]%
%
\raggedright%
\usekomavar{fromname}\\[\baselineskip]%
\ifkomavarempty{company}{}{%
\\
\usekomavar{company}%
}\\[\baselineskip]%
\usekomavar{professiona}\\[\baselineskip]%
\usekomavar{professionb}\\[2\baselineskip]%
\usekomavar{fromaddress}\\[\baselineskip]%
\usekomavar*{fromphone}\usekomavar{fromphone}\\[\baselineskip]%
\ifkomavarempty{fromfax}{}{%
\\
\usekomavar*{fromfax}\usekomavar{fromfax}%
}%
\usekomavar{fromemail}\\[\baselineskip]%
% \usekomavar{fromurl}\\%
\usekomavar{fromlinkedin}\\[2\baselineskip]%
\usekomavar{fromvatin}\\%
}%
}%
% Banking information
\put(0,0){\parbox[t]{\useplength{infocolwidth}}{%
\raggedleft
\vspace{\useplength{firstfootvpos}}%
\vspace{-\footskip}%
\usekomavar{frombank}%
}%
}%
\end{picture}%
\hspace*{\useplength{infocolwidth}}%
}%
\KOMAoption{refline}{nodate}
\setkomavar{nexthead}{%
\@tempswatrue
\if@twoside\ifodd\number\value{page}\else
\@tempswafalse
\fi\fi
\if@tempswa
\makebox[0pt][l]{%
\hspace*{-\oddsidemargin}\hspace{-1in}%
\hspace{\paperwidth}%
\hspace{-\useplength{infocolwidth}}%
\normalfont\fontsize{7}{8}\sffamily
\begin{picture}(0,0)
\put(0,0){\parbox[t]{\useplength{infocolwidth}}{%
\vspace*{-\topmargin}\vspace{-1in}%
\vspace{-\headheight}%
\vspace{\useplength{toaddrvpos}}%
\begin{tabular}{@{}c@{}}
\usekomavar{fromlogo}\\
\usekomavar{company}\\
\end{tabular}%
}%
}%
\end{picture}%
}%
\fi
}%
\pagestyle{headings}%
\endinput
custom_invoice_template.tex
% custom invoice template -- Minimal Working Example
% Based on:
% brieftemplate.tex
% Copyright 2008 Markus Kohm
\RequirePackage{fix-cm}
% \usepackage{mathpazo}
\usepackage[LGR,T1]{fontenc} % Also for ``Greek'' Content
\usepackage[latin9]{inputenc}
\usepackage{babel}
\usepackage{geometry}
\geometry{verbose,tmargin=0cm,bmargin=0cm}
\setlength{\parskip}{\smallskipamount}
% No indentation at all!
\setlength{\parindent}{0pt}
\usepackage{color}
\usepackage{array}
\usepackage{textcomp}
\usepackage{fixltx2e}
\usepackage{graphicx}
\usepackage{charter}
\usepackage[scaled]{helvet}
\usepackage[scaled=0.87]{luximono}
% \usepackage[scaled=0.92]{frutigernext}% Does not play nice!
%
\usepackage{setspace}
\setstretch{1.1000000000000001}
% hyperref
\usepackage[%
pdftitle={PDF-Title},
pdfauthor={Author},
pdfsubject={PDF-Subject},
pdfkeywords={keyword1, keyword2, keyword3},
linkcolor=magenta,
urlcolor=marineblue2,
citecolor=blue,
pdfstartview={FitH},
hyperfootnotes=false,
unicode=true,
bookmarks=false,
breaklinks=false,
pdfborder={0 0 0},
backref=false,
colorlinks=true]{hyperref}
% \providecommand{\SetSize}{%
% \AtBeginDvi{\special{papersize=210mm,210mm}}%
% \AtBeginDocument{%
% \ifpdfoutput{%
% \pdfpagewidth=210mm
% \pdfpageheight=210mm
% }{}%
% }%
% }
% \SetSize
%
\makeatletter
% Martin Vogels Symbols
\usepackage{marvosym}
\usepackage{ocr}
% Colors
\usepackage{xcolor}
% define marine blue
\definecolor{marineblue}{rgb}{0.05,0.1,0.4}
\definecolor{marineblue2}{rgb}{0.05,0.1,0.5}
% define lightgray
\definecolor{lightgray}{gray}{0.6}
\definecolor{lightgray2}{gray}{0.8}
\definecolor{lightgray-coursework}{gray}{0.3}
%% Remove preceeding '%' to uncomment an item
\KOMAoptions{%
DIV=last%
,headsepline=true% separate the header with a line on page >1
%,footsepline=true% separate the footer with a line on page >1
%pagenumber=botcenter% position of the page number (see docu)
%,parskip=false% Use indent instead of skip (more options cf. docu)
% ,fromalign=center% alignment of the address
,fromrule=aftername% separate the address with a line?
,fromphone=true% print sender phone number
,fromfax=false% print sender fax number
,fromemail=true% print sender e-mail address
,fromurl=true% print sender URL
,fromlogo=true% print a logo (position depends on fromalign)
%,addrfield=false% print an address field?
,backaddress=false% print the back address?
,subject=left%,titled% alternative subject layout and position
%,locfield=narrow% width of the (extra) location field
,foldmarks=false% print foldmarks?
%,numericaldate=true% date layout
,refline=wide% layout of the refline
}
%% Customize Separators
%\setkomavar{placeseparator}{ -- }
\setkomavar{backaddressseparator}{ $\cdot$ }
%\setkomavar{emailseparator}{ --> }
%\setkomavar{enclseparator}{ > }
%\setkomavar{faxseparator}{ --> }
%\setkomavar{phoneseparator}{ --> }
%\setkomavar{subjectseparator}{ >>> }
%% Customize fonts
%% Use LaTeX's standard font commands
%% Modify with \setkomafont or \addtokomafont
%% (see KOMA documentation)
% \setkomafont{backaddress}{\rmfamily}
%\setkomafont{descriptionlabel}{}
% \setkomafont{fromaddress}{\small}
\setkomafont{fromname}{\scshape}
%\setkomafont{pagefoot}{}
%\setkomafont{pagehead}{}
%\setkomafont{pagenumber}{}
%\setkomafont{subject}{}
%\setkomafont{title}{}
% Logo
\setkomavar{fromlogo}{\includegraphics[clip,width=3cm,height=3cm,bb = 0 0 200 100, draft, type=eps]{qr_coded_mecard}\\
{\scriptsize{\textcolor{lightgray}{MECARD}\hfill{}}}}
% Name
\setkomavar{fromname}{\noun{First & Last Name}}
% Signature
\setkomavar{signature}{\includegraphics[width=84mm,height=24mm,keepaspectratio,bb = 0 0 200 100, draft, type=eps]{signature}\\
{\small{First Last Name}}}
% Professional Identity
\setkomavar{company}{Company}
\setkomavar{professiona}{Professional Activities A}
\setkomavar{professionb}{Professional Activities B}
% VATin
\setkomavar{fromvatin}{VAT\,in \ocr{ZZ\,000\,000\,000}\\Public Financial Service}
% \setkomavar{yourvatin}{Your \ocr{VAT}}
% Address(es)
\setkomavar{fromaddress}{{\small\Letter~}\\Address Line 1\\Postal Code, City\\Country}
% \setkomavar{fromzipcode}
% Phone
\setkomavar{fromphone}[]{{\large\Mobilefone}\\{\ocr{+00\,9999\,666\,333}}}
% FAX
% \setkomavar{fromfax}[]
% e-Mail
\setkomavar{fromemail}{{\large\Email}\\{\href{mailto:userd-id@domain.name}{user-id\,@\,domain.name}}}
% Web
\setkomavar{fromurl}{{\Info}~\href{web:website.ext}{website.ext}}
\setkomavar{fromlinkedin}{\includegraphics[width=0.25cm,height=0.25cm]{linkedin.png}\\{\href{http://gr.linkedin.com/pub/AccountName}{linkedin.com/pub/AccountName}}}
% Banking
\setkomavar{frombank}{Account holder\\%
\textcolor{blue}{\ocr{First Name, Last Name}}\\%
IBAN\\%
\textcolor{blue}{\ocr{zz0000011111222223333344444}}\\%
SWIFT\,-\,BIC\\%
\textcolor{blue}{\ocr{QWERTYUI}}}%
custom_invoice_mwe.tex
%% custom invoice template -- Minimal Working Example
%% Based on:
% briefwbk.tex
% Copyright 2008 Markus Kohm
\documentclass[%
english,
custom_asymTypB,
DIV=8,
fontsize=11pt]{scrlttr2}
% What, Where, When?
\setkomavar{subject}{Quotation for... \textbf{yyy}}
% \setkomavar{toname}
% \setkomavar{toaddress}
% \setkomavar{customer}
% \setkomavar{refname}
% \setkomavar{refvalue}
% \setkomavar{invoice}
\setkomavar{myref}{Project: yyy}
% Place, Location
% \setkomavar{placeseparator}
\setkomavar{place}{Place}
% \setkomavar{location}{Location}
% Date
\setkomavar{date}{\today}
% Structure and Basic Information
\input{custom_invoice_template.tex}
\begin{document}
\begin{letter}{Mr. xxx xxx\\
Institution\\
Description\\
Address Line 1\\
Address Line 2\\
Country}
\opening{Dear xxx,}
\begin{flushleft}
herewith I am sending you a quotation...
\end{flushleft}
\closing{Sincerely yours,}
\encl{Enclosures}
\cc{}
\end{letter}
\end{document}
