我想在文件中主題行的左側添加一個小圖示scrlttr2
。我已經在scrartcl
文件中管理了此操作,但現在不知道如何在信件中執行此操作。你能幫助我嗎?
來自的程式碼scrartcl.cls
是:
\newcommand{\unquad}{\hskip-1.3em\relax}
\DeclareRobustCommand{\picturetodisplay}{\includegraphics{Bilder/Spiel_Start.jpg}}
\makeatletter
\def\@seccntformat#1{\unquad\unquad\picturetodisplay\quad}
\makeatother
有誰知道如何調用該主題的參考文獻scrlttr2
?
微量元素
\documentclass[a4paper, fontsize=10pt, DIV 14]{scrlttr2}
\KOMAoptions{%
locfield=wide, %
fromalign=left,%
fontsize=10pt, %
parskip=half %
}
\LoadLetterOption{DINmtext}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc}
\usepackage[scaled=.92]{helvet}
%------------------- It's all about this part -----------------------
\newcommand{\unquad}{\hskip-1.3em\relax}
\DeclareRobustCommand{\picturetodisplay}{\includegraphics{Bilder/Spiel_Start.jpg}} % This is the icon I want to use
\makeatletter
\def\@seccntformat#1{\unquad\unquad\picturetodisplay\quad}
\makeatother
%-------------------------------------------------------------------
\usepackage{blindtext}
\setkomavar{subject}{$\leftarrow$ There should appear the icon \glqq Spiel\_Start.jpg\grqq{}}
\begin{document}
\setkomavar{fromname}{Me}
\begin{letter}{Jon Doe}
\opening{Hey,}
\blindtext
\closing{Thank You. Over and out}
\end{letter}
\end{document}
被黑的scrartcl
部分如下圖所示:
謝謝邁克爾
答案1
您只需\includegraphics[width=1cm]{example-image-a}
在想要取得圖示的位置新增即可。因為我沒有您使用的映像,所以我只是使用映像example-image-a.jpg
frpm 套件 MWE(必須安裝但不能呼叫!)。
查看完整的程式碼(我刪除了你的程式碼片段的程式碼,因為這裡不需要/使用它):
\documentclass[a4paper, fontsize=10pt, DIV 14]{scrlttr2}
\KOMAoptions{%
locfield=wide, %
fromalign=left,%
fontsize=10pt, %
parskip=half %
}
\LoadLetterOption{DINmtext}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc}
\usepackage[scaled=.92]{helvet}
\usepackage{graphicx}
\usepackage{blindtext}
\setkomavar{subject}{\includegraphics[width=1cm]{example-image-a}$\leftarrow$ There should appear the icon \glqq Spiel\_Start.jpg\grqq{}}
\begin{document}
\setkomavar{fromname}{Me}
\begin{letter}{Jon Doe}
\opening{Hey,}
\blindtext
\closing{Thank You. Over and out}
\end{letter}
\end{document}
以及生成的 pdf:
答案2
您可以使用變數subjectseparator
:
\documentclass[a4paper, fontsize=10pt, DIV=14]{scrlttr2}% <- syntax changed: DIV=14
\KOMAoptions{%
locfield=wide, %
fromalign=left,%
fontsize=10pt,%
parskip=half,%
subject=titled % <- added
}
\LoadLetterOption{DINmtext}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc}
\usepackage[scaled=.92]{helvet}
\usepackage{graphicx}
\usepackage{blindtext}
\setkomavar{subject}{$\leftarrow$ There should appear the icon \glqq Spiel\_Start.jpg\grqq{}}
\setkomavar{subjectseparator}[]{\makebox[0pt][r]{\includegraphics[width=1.5em]{example-image}\enskip}}% <- added
\begin{document}
\setkomavar{fromname}{Me}
\begin{letter}{Jon Doe}
\opening{Hey,}
\blindtext
\closing{Thank You. Over and out}
\end{letter}
\end{document}
結果:
關於您的附加說明scrartcl
:如果您使用 KOMA-Script 類,請避免重新定義內部命令。您可以重新定義\sectionlinesformat
或也許\sectionformat
(取決於所需的結果)。