目标
我正在尝试复制创建下面的框
试图
到目前为止我已经做到了这一点
但是我的解决方案感觉很不合理,图像位置不正确,框未正确居中,线条间距不正确。有没有更好的方法来产生与上述类似的结果?
代码
我想我曾经用过这个图片在我的代码中
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{ctable} % for \specialrule command
\usepackage{tabularx} % in the preamble
\usepackage{fullpage}
\usepackage{multirow}
\usepackage{svg}
\begin{document}
\begin{tabularx}{\textwidth}{|X r|}
\specialrule{.1em}{.05em}{.05em} \hline & \\
\multirow{3}{*}{\includegraphics[height=2.5cm]{NTNU.png}} & \huge TMA4140 \\[0.2em] & \huge Diskre Matematikk \\[0.2em] & \huge Høst 2017 \\
& \\ & \\ & \\
\large Norges teknisk-vitenskapelige & \\
\large universitet & \textbf{Løsningsforslag --- Øving 1}\\
\large Insitutt for matematiske fag & \\
\hline \specialrule{.1em}{.05em}{.05em}
\end{tabularx}
\end{document}
答案1
使用一些低级技巧(来自 Alenanno 答案的标志):
\documentclass[a4paper]{article}
\usepackage{tikz}
\usepackage[utf8]{inputenc}
\definecolor{mblue}{RGB}{0,72,161}
\newcommand{\ntnulogo}{%
\leavevmode
\vtop{
\hrule height 0pt
\hbox{%
\begin{tikzpicture}
\fill[mblue, rounded corners=5mm] (0,2) rectangle (2,4);
\fill[white] (0.5,2.5) rectangle (1.5,3.5);
\fill[mblue] (1,3) circle (4mm);
\end{tikzpicture}%
}
}
}
\newcommand{\course}{%
\leavevmode
\vtop{\LARGE
\hrule height 0pt
\ialign{\hfil##\cr
TMA4140 Diskret\cr
Matematikk\cr
Høst 2017\cr
}%
}%
}
\begin{document}
\begin{center}
\setlength{\fboxsep}{0pt}
\fbox{%
\begin{minipage}{\dimexpr\textwidth-2\fboxrule}
\vspace{1pt}
\hrule height 1pt
\vspace{6pt}
\mbox{}\quad\ntnulogo\hfill\course\quad\mbox{}\\[3pt]
\mbox{}\quad
\begin{tabular}{@{}l@{}}
Norges teknisk-vitenskapelige\\
universitet\\
Insitutt for matematiske fag
\end{tabular}\hfill
\textbf{Løsningsforslag --- Øving 1}\quad\mbox{}\\
\vspace{3pt}
\hrule height1pt
\vspace{1pt}
\end{minipage}%
}
\end{center}
\end{document}
答案2
我认为有多种方法可以做到这一点,但我喜欢 TikZ,所以这里有一个使用这个包的解决方案。
输出
代码
\documentclass[margin=1cm]{standalone}
\usepackage{tikz}
\usepackage[utf8]{inputenc}
\definecolor{mblue}{RGB}{0,72,161}
\begin{document}
\begin{tikzpicture}
\fill[mblue, rounded corners=5mm] (0,2) rectangle (2,4);
\fill[white] (0.5,2.5) rectangle (1.5,3.5);
\fill[mblue] (1,3) circle (4mm);
\node[outer sep=0, inner sep=0, anchor=north west, text width=12cm] (bt) at (0,1.8) {%
Norges teknisk-vitenskapelige\\
universitet\hfill\textbf{Løsningsforslag --- Øving 1}\\
Insitutt for matematiske fag
};
\node[outer sep=0, inner sep=0, anchor=north east, text width=4cm, align=right, font=\Large] at (12,4) {%
TMA4140 Diskret\\
Matematikk\\
Høst 2017
};
\end{tikzpicture}
\end{document}