[编辑!] 我将代码更改为:
\documentclass[10pt]{article}
\usepackage[a4paper, left=2cm,top=0.8cm,right=2cm,bottom=3.3cm,headheight=61pt, footskip=61pt, includehead]{geometry}
\usepackage[default]{opensans}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage[ngerman]{babel}
\usepackage{multicol}
\usepackage{tabularx}
\newcommand{\cvTabItem}{\hspace{2px}\includegraphics[width=0.3cm]{images/bullet.png}\hspace{5px}}
\begin{document}
\begin{multicols*}{2}
\begin{center}
\setlength{\tabcolsep}{5pt}
\begin{tabularx}{\linewidth}{@{}lX@{}}
\cvTabItem 2015 – 2019 & Studium in der Fachrichtung „B.Sc. - Computervisualistik“ an der Universität Koblenz-Landau. Schwerpunkt auf Bildverarbeitung und Computergrafik.\\
\end{tabularx}
\end{center}
\end{multicols*}
\end{document}
所以我使用了 David 的答案中的 tabularx 行。但是现在我得到的是未满的 \hbox?
[编辑结束]
我使用以下代码来获取多列中带有自定义项目图标的表格。(我希望这是可以理解的)。在完整示例中,我有更多的代码,这就是为什么我的 \usepackage-list 这么长。
所以我的问题是为什么我会收到 \overfull 警告,我该如何解决它?我读过一些类似的问题,但我找不到适合我的情况的解决方案。
\documentclass[10pt]{article}
\usepackage[export]{adjustbox}
\usepackage[a4paper, left=2cm,top=0.8cm,right=2cm,bottom=3.3cm,headheight=61pt, footskip=61pt, includehead]{geometry}
\usepackage[default]{opensans}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage{multicol}
\usepackage{enumitem}
\usepackage{csquotes}
\usepackage{anyfontsize}
\makeatletter
\renewcommand\LARGE{\@setfontsize\LARGE{18pt}{20}}
\setlength\parskip{0.7cm}
\renewcommand{\paragraph}{\@startsection{paragraph}{4}{\z@}{-20px\@plus -30ex \@minus -.20px}{2px \@plus .5em}{\normalfont\MakeUppercase}}
\makeatother
\newcommand{\minsp}{%
\vspace{-0.7cm}
}%
\newcommand*{\cvItem}{\item[{\rule{0.44cm}{0.32cm}}]}
\setlist[itemize]{leftmargin=15px,parsep=0pt} % Einrückung Bullets in Liste
%Command for Subitem
\newcommand{\cvSubItem}[1]{%
\begin{itemize}%
\cvItem {#1}%
\end{itemize}%
}%
%Command for Item in Tabular
\newcommand{\cvTabItem}[1]{%
\setlist[itemize]{leftmargin=10px,parsep=0pt}%
\begin{minipage}[t]{0.5\textwidth}\cvSubItem{#1}\end{minipage}
}
\begin{document}
\begin{multicols}{2}
\paragraph{Ausbildung:}
\minsp
\begin{center}
\setlength{\tabcolsep}{5pt}
\begin{tabular}{p{0.3\linewidth}p{0.6\linewidth}}
\cvTabItem { 2015 – 2019 } & Das ist ein Test für eine mehrzeilige Tabelle in Verbindung einer Minipage zu Demonstrationszwecke.
\end{tabular}
\end{center}
\end{multicols}
\end{document}
答案1
无需本地文件即可运行的版本是
\documentclass[10pt]{article}
\usepackage[a4paper, left=2cm,top=0.8cm,right=2cm,bottom=3.3cm,headheight=61pt, footskip=61pt, includehead]{geometry}
\usepackage[default]{opensans}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[draft]{graphicx}
\usepackage[ngerman]{babel}
\usepackage{tabularx}
\usepackage{enumitem}
\usepackage{multicol}
\makeatletter
\renewcommand\LARGE{\@setfontsize\LARGE{18pt}{20}}
\setlength\parskip{0.7cm}
\renewcommand{\paragraph}{\@startsection{paragraph}{4}{\z@}{-20px\@plus -30ex \@minus -.20px}{2px \@plus .5em}{\normalfont\MakeUppercase}}
\makeatother
\newcommand{\minsp}{%
\vspace{-0.7cm}%
}%
\newcommand*{\cvItem}{\item[{\includegraphics[width=0.3cm]{images/bullet.png}}]}
\setlist[itemize]{leftmargin=15px,parsep=0pt} % Einrückung Bullets in Liste
%Command for Subitem
\newcommand{\cvSubItem}[1]{%
\begin{itemize}%
\cvItem {#1}%
\end{itemize}%
}%
%Command for Item in Tabular
\newcommand{\cvTabItem}[1]{%
\setlist[itemize]{leftmargin=10px,parsep=0pt}%
\begin{minipage}[t]{0.5\textwidth}\cvSubItem{#1}\end{minipage}
}
\begin{document}
\begin{multicols}{2}
\paragraph{Ausbildung:}
\minsp
%\label{par:ausbildung}
\begin{center}
\setlength{\tabcolsep}{5pt}
\begin{tabularx}{\linewidth}{p{0.3\linewidth}p{0.6\linewidth}}
\cvTabItem { 2015 – 2019 } & Das ist ein Test für eine mehrzeilige Tabelle in Verbindung einer Minipage zu Demonstrationszwecke.
\end{tabularx}
\end{center}
\end{multicols}
\end{document}
首先注意tabularx
需要X列,
\begin{tabularx}{\linewidth}{p{0.3\linewidth}p{0.6\linewidth}}
指定表格必须很\linewidth
宽,但是 tabularx 无法实现这一点,列规范有两个 p 列总共 .9\linewidth 加上 4 *5pt \tabcolsep 填充,因此如果 .9\linewidth+20pt 太宽或太小,框将会超出或未满,但\linewisdth
对此tabularx
无能为力。
使用
\begin{tabular}{p{0.3\linewidth}p{0.6\linewidth}}
然后在第一列里面,文本块宽度为 3\linewidth 但是您已经使用了\cvTabItem
涉及的\begin{minipage}[t]{0.5\textwidth}
,所以这不适合。
我猜你想要类似的东西
\documentclass[10pt]{article}
\usepackage[a4paper, left=2cm,top=0.8cm,right=2cm,bottom=3.3cm,headheight=61pt, footskip=61pt, includehead]{geometry}
\usepackage[default]{opensans}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[draft]{graphicx}
\usepackage[ngerman]{babel}
\usepackage{tabularx}
\usepackage{enumitem}
\usepackage{multicol}
\makeatletter
\renewcommand\LARGE{\@setfontsize\LARGE{18pt}{20}}
\setlength\parskip{0.7cm}
\renewcommand{\paragraph}{\@startsection{paragraph}{4}{\z@}{-20px\@plus -30ex \@minus -.20px}{2px \@plus .5em}{\normalfont\MakeUppercase}}
\makeatother
\newcommand{\minsp}{%
\vspace{-0.7cm}%
}%
\newcommand*{\cvItem}{\raggedright \rule{.3cm}{.3cm} }
\begin{document}%\showoutput
\begin{multicols}{2}
\paragraph{Ausbildung:}
\minsp
%\label{par:ausbildung}
\begin{center}
\setlength{\tabcolsep}{5pt}%
\begin{tabularx}{\linewidth}{@{}lX@{}}
\cvItem 2015 – 2019 & Das ist ein Test für eine mehrzeilige Tabelle in Verbindung einer Minipage zu Demonstrationszwecke.
\end{tabularx}
\end{center}
\end{multicols}
\end{document}
(最后我回到了 tabularx,用 X 作为右侧列)
答案2
好的,@David Carlisle 的回答对我有帮助。我只是使用了 minipage,因为我没有将 itemize 放入表格中。但是,如果我创建一个
\newcommand{\cvTabItem}{\includegraphics[width=0.3cm]{images/bullet.png}\vspace{15px}}
现在我的代码(带有本地文件)如下所示:
\documentclass[10pt]{article}
\usepackage[a4paper, left=2cm,top=0.8cm,right=2cm,bottom=3.3cm,headheight=61pt, footskip=61pt, includehead]{geometry}
\usepackage[default]{opensans}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[draft]{graphicx}
\usepackage[ngerman]{babel}
\usepackage{tabularx}
\usepackage{enumitem}
\usepackage{multicol}
\makeatletter
\renewcommand\LARGE{\@setfontsize\LARGE{18pt}{20}}
\setlength\parskip{0.7cm}
\renewcommand{\paragraph}{\@startsection{paragraph}{4}{\z@}{-20px\@plus -30ex \@minus -.20px}{2px \@plus .5em}{\normalfont\MakeUppercase}}
\makeatother
\newcommand{\minsp}{%
\vspace{-0.7cm}%
}%
\newcommand{\cvTabItem}{\includegraphics[width=0.3cm]{images/bullet.png}\hspace{5px}}%\hspace to get space between image and text
\begin{document}%\showoutput
\begin{multicols}{2}
\paragraph{Ausbildung:}
\minsp
%\label{par:ausbildung}
\begin{center}
\setlength{\tabcolsep}{5pt}%
\begin{tabularx}{\linewidth}{@{}lX@{}}
\cvTabItem 2015 – 2019 & Das ist ein Test für eine mehrzeilige Tabelle in Verbindung einer Minipage zu Demonstrationszwecke.
\end{tabularx}
\end{center}
\end{multicols}
\end{document}
但是现在我收到了 \hbox 未满的警告 :S