有人能帮帮我吗?我试图将文本换行到每一列,以便最后一列具有最大的宽度。
\documentclass{article}
\usepackage{makecell, tabularx}
\renewcommand\theadfont{\bfseries}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}
\begin{document}
\begin{table}
\footnotesize
\setlength\tabcolsep{3pt}
\begin{tabularx}{\textwidth} {|*{6}{ L| } }
\hline
\thead[b]{Risk}
& \thead[b]{Likelihood}
& \thead[b]{Impact}
& \thead[b]{Overall}
& \thead[b]{Response}
\\ \hline
Going over budget
& M
& L
& M
& \textbf{Preventative:} Keep track of all spending and have clearance of all potential spending by all project team members as well as the sponsor.
\\ \hline
Not having staff ambassadors
& M
& L
& M
& \textbf{Preventative:} Ask as many staff members as possible to maximise the chances of having staff agreeing to represent their school.
\\ \hline
Small turnout for event
& M
& M
& M
& \textbf{Preventative:} Raise awareness for the event for at least a month in advance and continue to raise awareness.\newline \textbf{Opportunity:} Allows for a more intimate event and gain detailed attendee feedback
\\ \hline
Not meeting project event deadline
& L
& H
& M
& \textbf{Preventive:} Ensure that all project team members meet their individual task deadlines and allow for some float time by constructing a critical path analysis
\\ \hline
Reaching venue capacity
& M
& H
& M
& \textbf{Preventive:} Have attendees RSVP to the event to give an indication of numbers for the event which will allow the project team \newline
\textbf{Opportunity:} Allows for a bigger audience for the team to deliver the presentation to and create greater awareness of the collaboration tool.
\\ \hline
Technical issues during showcase
& H
& H
& H
& \textbf{Preventive:} test all technical equipment before event begins\newline
\textbf{Corrective:} have back-up devices ready \newline
Connect to mobile phone internet
\\ \hline
Catering for event does not deliver
& M
& L
& M
& \textbf{Preventive:} Confirm with catering providers that food and drink will be delivered on time\newline
\textbf{Corrective: }
\\ \hline
Sponsor does not agree with event plans
& L
& H
& M
& \textbf{Preventive:} have continuous communication with the sponsor and have them sign everything off
\\ \hline
\end{tabularx}
\end{table}
\end{document}
答案1
以下使用固定宽度的列作为第一列 - p{<len>}
,后跟三个c
输入列和一个最后的X
- 类列(使用\raggedright
对齐:
\documentclass{article}
\usepackage{makecell, tabularx}
\renewcommand\theadfont{\bfseries}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}
\begin{document}
\noindent
\begingroup
\footnotesize
\setlength\tabcolsep{3pt}%
\begin{tabularx}{\linewidth}{ | >{\raggedright}p{5em} | *{3}{ c| } L| }
\hline
\thead[b]{Risk}
& \thead[b]{Likelihood}
& \thead[b]{Impact}
& \thead[b]{Overall}
& \thead[b]{Response}
\\ \hline
Going over budget
& M
& L
& M
& \textbf{Preventative:} Keep track of all spending and have clearance of all potential spending by all project team members as well as the sponsor.
\\ \hline
Not having staff ambassadors
& M
& L
& M
& \textbf{Preventative:} Ask as many staff members as possible to maximise the chances of having staff agreeing to represent their school.
\\ \hline
Small turnout for event
& M
& M
& M
& \textbf{Preventative:} Raise awareness for the event for at least a month in advance and continue to raise awareness.\newline \textbf{Opportunity:} Allows for a more intimate event and gain detailed attendee feedback
\\ \hline
Not meeting project event deadline
& L
& H
& M
& \textbf{Preventive:} Ensure that all project team members meet their individual task deadlines and allow for some float time by constructing a critical path analysis
\\ \hline
Reaching venue capacity
& M
& H
& M
& \textbf{Preventive:} Have attendees RSVP to the event to give an indication of numbers for the event which will allow the project team \newline
\textbf{Opportunity:} Allows for a bigger audience for the team to deliver the presentation to and create greater awareness of the collaboration tool.
\\ \hline
Technical issues during showcase
& H
& H
& H
& \textbf{Preventive:} test all technical equipment before event begins\newline
\textbf{Corrective:} have back-up devices ready \newline
Connect to mobile phone internet
\\ \hline
Catering for event does not deliver
& M
& L
& M
& \textbf{Preventive:} Confirm with catering providers that food and drink will be delivered on time\newline
\textbf{Corrective: }
\\ \hline
Sponsor does not agree with event plans
& L
& H
& M
& \textbf{Preventive:} have continuous communication with the sponsor and have them sign everything off
\\ \hline
\end{tabularx}
\endgroup
\end{document}
您可以调整长度<len>
来满足您的需要。
请注意,您的表格只有五列(您已设置*{6}{..}
)。此外,我使用%
了\setlength{\tabcolsep}{3pt}
因为它引入了您想要避免的虚假空间。
答案2
或者调整L
列类型的大小:
\documentclass{article}
\usepackage{makecell, tabularx}
\renewcommand\theadfont{\bfseries}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}
\usepackage{rotating}
\usepackage{geometry}
\begin{document}
\begin{table}[htb]
\caption{Risk Register \label{table6}}
\footnotesize
\setlength\tabcolsep{3pt}
\begin{tabularx}{\textwidth}{|>{\hsize=0.5\hsize}L|*{3}{ c| } >{\hsize=1.5\hsize}L | }
\hline
\thead{Risk}
& \thead{Likelihood}
& \thead{Impact}
& \thead{Overall}
& \thead{Response}
\\ \hline
Going over budget
& M
& L
& M
& \textbf{Preventative:} Keep track of all spending and have clearance of all potential spending by all project team members as well as the sponsor.
\\ \hline
Not having staff ambassadors
& M
& L
& M
& \textbf{Preventative:} Ask as many staff members as possible to maximise the chances of having staff agreeing to represent their school.
\\ \hline
Small turnout for event
& M
& M
& M
& \textbf{Preventative:} Raise awareness for the event for at least a month in advance and continue to raise awareness.\newline \textbf{Opportunity:} Allows for a more intimate event and gain detailed attendee feedback
\\ \hline
Not meeting project event deadline
& L
& H
& M
& \textbf{Preventive:} Ensure that all project team members meet their individual task deadlines and allow for some float time by constructing a critical path analysis
\\ \hline
Reaching venue capacity
& M
& H
& M
& \textbf{Preventive:} Have attendees RSVP to the event to give an indication of numbers for the event which will allow the project team \newline
\textbf{Opportunity:} Allows for a bigger audience for the team to deliver the presentation to and create greater awareness of the collaboration tool.
\\ \hline
Technical issues during showcase
& H
& H
& H
& \textbf{Preventive:} test all technical equipment before event begins\newline
\textbf{Corrective:} have back-up devices ready \newline
Connect to mobile phone internet
\\ \hline
Catering for event does not deliver
& M
& L
& M
& \textbf{Preventive:} Confirm with catering providers that food and drink will be delivered on time\newline
\textbf{Corrective: }
\\ \hline
Sponsor does not agree with event plans
& L
& H
& M
& \textbf{Preventive:} have continuous communication with the sponsor and have them sign everything off
\\ \hline
\end{tabularx}
\end{table}
\end{document}