latex - Tabularx 在 Tikz 节点中的行为不同
问题描述
我创建了一个tabularx
表,当我将它放在Tikz
节点中时,它的行为会有所不同。
我的目标是充分证明单元格内的文本。你会在下面找到我的 LaTeX 代码。对不起,有点杀戮,我远非专家。
谢谢。
\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage{tikz}
\usepackage{tabularx}
\setlength{\extrarowheight}{-5pt}
\begin{document}
\section{Inside Tikz Node}
\begin{tikzpicture}[remember picture,overlay]
\node[text width=11.5cm] at (5.72, -4.5) {
\begin{tabularx}{\textwidth}{|>{\hsize=2.2cm}X>{\hsize=9cm}X}
\footnotesize{2011} & \textbf{\footnotesize{Regional Co-Manager}} \\
& \textbf{\scriptsize{Dunder Mifflin, Scranton PA}}\\
& \footnotesize{A major part of Jim Halpert's character is his relationship with Pam Beesly, which is often the subject of office speculation. This is made worse by the fact that Pam was engaged to Roy Anderson, a Dunder Mifflin warehouse worker. Throughout the first two seasons, incidents such as Pam falling asleep on Jim's shoulder in "Diversity Day" and drunkenly kissing him in "The Dundies" show a possibility of the feelings being mutual; however, Pam never acts on them and she remains engaged to Roy.}\\
\\
\hspace{-3.075mm}$\bullet$\hspace{1.7mm}\footnotesize{2005} & \textbf{\footnotesize{Sales Representative}} \\
& \textbf{\scriptsize{Dunder Mifflin, Scranton PA}}\\
& \footnotesize{Jim has two brothers; Pete, who lives in Boston, and Tom, who lives in New Jersey. They are both characterized as sharing Jim's general love of pranks but have come across as unpleasant and they somewhat bully their little brother. While Pete and Tom have been seen in several episodes, portrayed by Tug Coker, and Blake Robbins, Larissa has never been seen on screen.}\\
\end{tabularx}
};
\end{tikzpicture}
\vspace{9cm}
\section{Outside Tikz Node}
\begin{tabularx}{\textwidth}{|>{\hsize=2.2cm}X>{\hsize=9cm}X}
\footnotesize{2011} & \textbf{\footnotesize{Regional Co-Manager}} \\
& \textbf{\scriptsize{Dunder Mifflin, Scranton PA}}\\
& \footnotesize{A major part of Jim Halpert's character is his relationship with Pam Beesly, which is often the subject of office speculation. This is made worse by the fact that Pam was engaged to Roy Anderson, a Dunder Mifflin warehouse worker. Throughout the first two seasons, incidents such as Pam falling asleep on Jim's shoulder in "Diversity Day" and drunkenly kissing him in "The Dundies" show a possibility of the feelings being mutual; however, Pam never acts on them and she remains engaged to Roy.}\\
\\
\hspace{-3.075mm}$\bullet$\hspace{1.7mm}\footnotesize{2005} & \textbf{\footnotesize{Sales Representative}} \\
& \textbf{\scriptsize{Dunder Mifflin, Scranton PA}}\\
& \footnotesize{Jim has two brothers; Pete, who lives in Boston, and Tom, who lives in New Jersey. They are both characterized as sharing Jim's general love of pranks but have come across as unpleasant and they somewhat bully their little brother. While Pete and Tom have been seen in several episodes, portrayed by Tug Coker, and Blake Robbins, Larissa has never been seen on screen.}\\
\end{tabularx}
\end{document}
解决方案
TikZ nodes are not justified by default, but you can make them justified by using the align=justify
key:
\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage{tikz}
\usepackage{tabularx}
\setlength{\extrarowheight}{-5pt}
\begin{document}
\section{Inside Tikz Node}
\begin{tikzpicture}[remember picture,overlay]
\node[text width=11.5cm,align=justify] at (5.72, -4.5) {
\begin{tabularx}{\textwidth}{|>{\hsize=2.2cm}X>{\hsize=9cm}X}
\footnotesize{2011} & \textbf{\footnotesize{Regional Co-Manager}} \\
& \textbf{\scriptsize{Dunder Mifflin, Scranton PA}}\\
& \footnotesize{A major part of Jim Halpert's character is his relationship with Pam Beesly, which is often the subject of office speculation. This is made worse by the fact that Pam was engaged to Roy Anderson, a Dunder Mifflin warehouse worker. Throughout the first two seasons, incidents such as Pam falling asleep on Jim's shoulder in "Diversity Day" and drunkenly kissing him in "The Dundies" show a possibility of the feelings being mutual; however, Pam never acts on them and she remains engaged to Roy.}\\
\\
\hspace{-3.075mm}$\bullet$\hspace{1.7mm}\footnotesize{2005} & \textbf{\footnotesize{Sales Representative}} \\
& \textbf{\scriptsize{Dunder Mifflin, Scranton PA}}\\
& \footnotesize{Jim has two brothers; Pete, who lives in Boston, and Tom, who lives in New Jersey. They are both characterized as sharing Jim's general love of pranks but have come across as unpleasant and they somewhat bully their little brother. While Pete and Tom have been seen in several episodes, portrayed by Tug Coker, and Blake Robbins, Larissa has never been seen on screen.}\\
\end{tabularx}
};
\end{tikzpicture}
\vspace{9cm}
\section{Outside Tikz Node}
\begin{tabularx}{\textwidth}{|>{\hsize=2.2cm}X>{\hsize=9cm}X}
\footnotesize{2011} & \textbf{\footnotesize{Regional Co-Manager}} \\
& \textbf{\scriptsize{Dunder Mifflin, Scranton PA}}\\
& \footnotesize{A major part of Jim Halpert's character is his relationship with Pam Beesly, which is often the subject of office speculation. This is made worse by the fact that Pam was engaged to Roy Anderson, a Dunder Mifflin warehouse worker. Throughout the first two seasons, incidents such as Pam falling asleep on Jim's shoulder in "Diversity Day" and drunkenly kissing him in "The Dundies" show a possibility of the feelings being mutual; however, Pam never acts on them and she remains engaged to Roy.}\\
\\
\hspace{-3.075mm}$\bullet$\hspace{1.7mm}\footnotesize{2005} & \textbf{\footnotesize{Sales Representative}} \\
& \textbf{\scriptsize{Dunder Mifflin, Scranton PA}}\\
& \footnotesize{Jim has two brothers; Pete, who lives in Boston, and Tom, who lives in New Jersey. They are both characterized as sharing Jim's general love of pranks but have come across as unpleasant and they somewhat bully their little brother. While Pete and Tom have been seen in several episodes, portrayed by Tug Coker, and Blake Robbins, Larissa has never been seen on screen.}\\
\end{tabularx}
\end{document}
推荐阅读
- python - 使用python将经纬度坐标自动填充到excel中
- python - ImportError:无法导入名称“convert_from_path”
- php - Laravel Blade 模板中的代码补全 - vscode
- swift - 导航栏项目中带有操作按钮的另一个视图
- html - 如何正确调整iPhone上的宽度?
- android-studio - 如何在 Android Studio 中快速定位文件夹树结构中的文件?
- java - 我可以只用一种类型的变量在两种不同类型的数组中搜索值吗?
- c++ - std::string myString{"Hello", "World"} 中的第二个参数有什么作用?
- c - 在使用两个并行线程将一个数字相加然后减回 0 的 C 程序中,我得到一个非零的答案。这似乎不可能
- javascript - 在 jquery 中使用 for 循环(.each)