
我使用了來自的說明
建立一個帶有橫向模式繪圖的表格。
頁面已翻轉,但左側朝上,而不是右側朝上。
此外,橫向頁面的大小只有普通頁面的一半。這是為什麼?
我的程式碼:
\begin{sideways}
\begin{landscape}
\begin{sidewaysfigure}
\par \textbf{Results for the CHSH}
\begin{tabular}{|c|c|c|c|}
\hline
\multirow{epsilon} & \multicolumn{3}{c|}{some text}\tabularnewline
\cline{2-4}
& some more text\tabularnewline
\hline
0 (asdsa) & \includegraphics[width=0.45\textwidth]{dasdas} & \includegraphics[width=0.45\textwidth]{asda} & \includegraphics[width=0.45\textwidth]{asda}\tabularnewline
\hline
0.1 & \includegraphics[width=0.45\textwidth]{asdas} & \includegraphics[width=0.45\textwidth]{asdas} & \includegraphics[width=0.45\textwidth]{asdasd}\tabularnewline
\hline
10 & \includegraphics[width=0.45\textwidth]{asdasdas} & \includegraphics[width=0.45\textwidth]{asdasd} & \includegraphics[width=0.45\textwidth]{adasda}\tabularnewline
\hline
100 & \includegraphics[width=0.45\textwidth]{asdasdad} & \includegraphics[width=0.45\textwidth]{sadasd} & \includegraphics[width=0.45\textwidth]{asdasdad}\tabularnewline
\hline
\end{tabular}
\end{sidewaysfigure}
\end{landscape}
\end{sideways}
我只是用一些隨機的東西替換了表格的內容。有人可以幫忙嗎?
答案1
您發布的程式碼存在一些概念問題:
嵌套
sideways
、、landscape
和sidewaysfigure
環境必然會帶給你悲傷。單一sidewaysfigure
環境就足夠了。您正在嘗試設定一個
tabular
總寬度嚴重超過(旋轉的)文字區塊寬度的環境。 (例如,0.45*3=1.35>>1——這甚至沒有考慮第一列的寬度!)我不會自己計算最大可用列寬度,而是使用一個tabularx
環境,設定其整體寬度,讓\textwidth
LaTeX 計算第2 、3 和4 列的可用寬度,並指定\linewidth
為 12 個圖形中每個圖形的寬度。若要獲得可預測的標題位置,請使用
\caption
命令。如果你這樣做不是如果需要「Figure :」前綴,請務必載入該caption
套件並用於\caption*
產生標題。這就是下面範例中所做的事情。
一個小挑剔:\multirow
指令需要三爭論,沒有一個。
\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{rotating,multirow,tabularx,caption}
\captionsetup{font=bf} % use this instruction if you really need bold captions
\begin{document}
\begin{sidewaysfigure}
\caption*{Results for the CHSH} % use "\caption" if you want numbered output
\begin{tabularx}{\textwidth}{|c|X|X|X|} % let LaTeX calculate width of columns 2, 3, and 4
\hline
\multirow{2}{*}{epsilon}
& \multicolumn{3}{c|}{some text}\\
\cline{2-4}
& \multicolumn{1}{c|}{some more text} & & \\
\hline
0 (asdsa) &
\includegraphics[width=\linewidth]{dasdas} &
\includegraphics[width=\linewidth]{asda} &
\includegraphics[width=\linewidth]{asda}\\
\hline
0.1 &
\includegraphics[width=\linewidth]{asdas} &
\includegraphics[width=\linewidth]{asdas} &
\includegraphics[width=\linewidth]{asdasd}\\
\hline
10 &
\includegraphics[width=\linewidth]{asdasdas} &
\includegraphics[width=\linewidth]{asdasd} &
\includegraphics[width=\linewidth]{adasda}\\
\hline
100 &
\includegraphics[width=\linewidth]{asdasdad} &
\includegraphics[width=\linewidth]{sadasd} &
\includegraphics[width=\linewidth]{asdasdad}\\
\hline
\end{tabularx}
\end{sidewaysfigure}
\end{document}
答案2
如果沒有可以編譯以重現問題的正確範例,我無法準確告訴您出了什麼問題。我進行了實驗,但未能重現您所描述的問題。
即使在完成程式碼以建立最小文件後,我仍然遇到錯誤:
\multirow{}{}{}
需要 3 個參數 - 而不是 1 個- 如果不採取特殊措施,沒有人可以編寫需要他們沒有的文件的文檔
從文件名來看,我猜測您在發布之前沒有測試您的範例。如果範例無法重現您需要幫助的問題,那麼它就沒什麼用處。如果您不對其進行測試以確保它能夠重現該問題,則示例不太可能重現該問題。
我可以說使用它肯定是一個錯誤sideways
和 landscape
和 sidewaysfigure
。您可能想要其中之一。我選擇了第三種,但你可以選擇。我還調整了圖像大小以使黑框適合頁面,切換到\caption
,更正了缺少的垂直線,更正了\multirow
和 用於$\epsilon$
節省空間。
您的公里數可能會有所不同。
\documentclass[a4paper]{article}
\usepackage[demo]{graphicx}
\usepackage{rotating,multirow}
\begin{document}
\begin{sidewaysfigure}
\centering
\caption{Results for the CHSH}
\begin{tabular}{|c|c|c|c|}
\hline
\multirow{2}*{$\epsilon$} & \multicolumn{3}{c|}{some text}\tabularnewline
\cline{2-4}
& some more text &&\tabularnewline
\hline
0 (asdsa) & \includegraphics[width=0.25\textwidth]{dasdas} & \includegraphics[width=0.25\textwidth]{asda} & \includegraphics[width=0.25\textwidth]{asda}\tabularnewline
\hline
0.1 & \includegraphics[width=0.25\textwidth]{asdas} & \includegraphics[width=0.25\textwidth]{asdas} & \includegraphics[width=0.25\textwidth]{asdasd}\tabularnewline
\hline
10 & \includegraphics[width=0.25\textwidth]{asdasdas} & \includegraphics[width=0.25\textwidth]{asdasd} & \includegraphics[width=0.25\textwidth]{adasda}\tabularnewline
\hline
100 & \includegraphics[width=0.25\textwidth]{asdasdad} & \includegraphics[width=0.25\textwidth]{sadasd} & \includegraphics[width=0.25\textwidth]{asdasdad}\tabularnewline
\hline
\end{tabular}
\end{sidewaysfigure}
\end{document}