LaTeX 标题中的徽标,Koma-Script 字母类

LaTeX 标题中的徽标,Koma-Script 字母类

我在我的文档的序言中使用了这个类定义:

\documentclass[template, 
           backaddress=off, 
           foldmarks=false, 
           enlargefirstpage,
           pagenumber=off,
           parskip=half
           ]{scrlttr2}

我将标题设置为左侧带有徽标、右侧带有信息,如下所示:

\firsthead{ 
\parbox[b]{\textwidth}{\raggedleft{ 
\rlap{\usekomavar{fromlogo}}
  \addfontfeature{LetterSpace=20.0}\fontsize{12}{17}\selectfont\scshape \usekomavar{fromname}\\[3mm]
     \fontsize{11}{11}\selectfont\scshape \usekomavar{position} \\ \usekomavar{department}
     }%
   }% 
}%

但是徽标和退货地址没有对齐。在任何其他类中,我都可以使用该fancyhdr包来指定左头和右头,如下所示:

\usepackage{fancyhdr}
\setlength{\headheight}{1cm}
\setlength{\headwidth}{\textwidth}
\fancyhead[L]{ % left
\addfontfeature{LetterSpace=20.0}\fontsize{12}{17}\selectfont\scshape
\usekomavar{fromname}\\[3mm]
    \fontsize{11}{11}\selectfont\scshape \usekomavar{position} \\
\usekomavar{department}
}
 \fancyhead[R]{ % right
 \includegraphics[width=4cm]{kuleuven_zwart.eps}
}
\pagestyle{fancy}

但这对于班级来说不起作用letter。我怎样才能实现类似的效果?


模板代码:

\ProvidesFile{template.lco}

\usepackage{graphicx}   
\usepackage{fontspec}
\usepackage{marvosym}
\usepackage{eso-pic}
\usepackage{geometry} 
\geometry{a4paper, textwidth=17cm, textheight=22cm, marginparsep=16cm, marginparwidth=1cm}

\newkomavar{department}
\newkomavar{position}
\setkomavar{fromlogo}{\includegraphics[width=4cm]{kuleuven_zwart.eps}}

% ===  FORMATTING STUFF
\@setplength{backaddrheight}{0cm}

% shift the page body on the left to make room for data and logo
\setlength{\oddsidemargin}{\useplength{toaddrhpos}}
\addtolength{\oddsidemargin}{-1in}
\l@addto@macro{\@typearea@end}{
\setlength{\oddsidemargin}{\useplength{toaddrhpos}}
\addtolength{\oddsidemargin}{-1in}
}%

%set the font size and leading
\renewcommand{\normalsize}{\fontsize{10.0}{17}\selectfont}

% === HEADER DEFINITION
\firsthead{ 

 \parbox[b]{\textwidth}{\raggedleft{ 

    \rlap{\usekomavar{fromlogo}}

      \addfontfeature{LetterSpace=20.0}\fontsize{12}{17}\selectfont\scshape \usekomavar{fromname}\\[5mm]
         \fontsize{11}{11}\selectfont\scshape \usekomavar{position} \\ \usekomavar{department}

    }%
  }%

}%

\endinput

文档:

\documentclass[template, 
               backaddress=off, 
               foldmarks=false, 
               pagenumber=off,
               ]{scrlttr2}

\usepackage{lipsum}   

\setkomavar{fromname}{this}
\setkomavar{position}{is not}
\setkomavar{department}{aligned}
\begin{document}

\begin{letter}{%
       Yeti\\%
      from Himalayah\\%
}

\opening{Dear,}

\lipsum

\closing{Regards,}


\end{letter}
\end{document}

答案1

我建议您使用两个\parboxes(一个用于徽标,另一个用于右侧的信息),以及\adjustbox来自调整框包的命令来控制相对于徽标的垂直对齐;还要注意多余的空白:

\ProvidesFile{template.lco}

\usepackage{graphicx}   
\usepackage{fontspec}
\usepackage{marvosym}
\usepackage{eso-pic}
\usepackage{geometry} 
\usepackage{adjustbox}
\geometry{a4paper, textwidth=17cm, textheight=22cm, marginparsep=16cm, marginparwidth=1cm}

\newkomavar{department}
\newkomavar{position}
\setkomavar{fromlogo}{\adjustbox{valign=t}{\includegraphics[width=4cm]{kuleuven_zwart.eps}}}

% ===  FORMATTING STUFF
\@setplength{backaddrheight}{0cm}

% shift the page body on the left to make room for data and logo
\setlength{\oddsidemargin}{\useplength{toaddrhpos}}
\addtolength{\oddsidemargin}{-1in}
\l@addto@macro{\@typearea@end}{
\setlength{\oddsidemargin}{\useplength{toaddrhpos}}
\addtolength{\oddsidemargin}{-1in}
}%

%set the font size and leading
\renewcommand{\normalsize}{\fontsize{10.0}{17}\selectfont}

% === HEADER DEFINITION
\firsthead{% 
 \parbox[t]{0.5\textwidth}{% 
    \usekomavar{fromlogo}}\parbox[t]{0.5\textwidth}{\raggedleft{
      \addfontfeature{LetterSpace=20.0}\fontsize{12}{17}\selectfont\scshape \usekomavar{fromname}\\[5mm]
         \fontsize{11}{11}\selectfont\scshape \usekomavar{position} \\ \usekomavar{department}%
    }%
  }%
}%

\endinput

这是示例代码结果的部分图像,使用 CTAN 狮子(由 Duane Bibby 绘制)作为图像:

在此处输入图片描述

相关内容