不需要的垂直和单词间空间 - tabularx

不需要的垂直和单词间空间 - tabularx

我正在尝试使用tabularx软件包创建日历。我设法使表格正确无误,但单词之间和行之间似乎有很多空格。这让我想起了对齐的 MS Word 文档,其中单词之间无缘无故地出现了不必要的空格。

问题:

  1. 如何减少行距并消除单词之间的空格?[这样我就有空间在接下来的两周内添加另外两行。]
  2. 我做错什么了吗?[当然,我不确定这是否是创建日历的正确方法。]

我需要在每个“框”内包含相当多的文本,正如从 MWE 和 PDF 输出的屏幕截图中看到的那样。[我不知道为什么“JANUARY”上面会出现一行。]

\documentclass[12pt]{article}
\usepackage{tabularx}
\usepackage[xetex,a4paper,landscape,margin=1cm]{geometry}
\usepackage[final]{microtype}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}

\usepackage{anyfontsize}
\usepackage{polyglossia}
\setmainfont{Linux Libertine O}

\newcolumntype{C}{>{ \Large \arraybackslash}X}
\newcommand{\ti}{\fontsize{14}{11}\selectfont }
\newcommand{\wday}{\bfseries \fontsize{15}{11}\selectfont}
\newcommand{\dat}{\bfseries \fontsize{15}{11}\selectfont}


\begin{document}
\begin{center}
            \Huge \textbf{JANUARY}
    \end{center}
\begin{tabularx}{28cm}{@{\rule[-2ex]{0pt}{5ex}}|*{7}{C|}}
    \hline
    {\wday MON} & {\wday TUE} & {\wday WED} & {\wday THU} & {\wday FRI} & {\wday SAT} & {\wday SUN}   \\ \hline 
    {\dat 2} \textbf{Putradā Ekādaśī}   & 
    {\dat 3} {\ti [06:59 - 10:44]; \textbf{App.}  Śrī Jagadīśa  Paṇḍita} & 
    {\dat 4} {\ti } & 
    {\dat 5} {\ti } & 
    {\dat 6} {\ti Śrī Kṛṣṇa Puṣya Abhiśeka}     &
    {\dat 7} {\ti \textbf{Māga māsa begins}}& 
    {\dat 8} {\ti }  \\ 
    &  &  &  &  &  &  \\  &  &  &  &  &  & \\ \hline
    {\dat 9} {\ti }& 
    {\dat 10} {\ti } & 
    {\dat 11} {\ti } & 
    {\dat 12}   {\ti [footnote]\footnote{\textbf{Disapp.:} Śrī Rāmacandra Kavirāja; \textbf{App.:} Śrīla Gopāla Bhaṭṭa Gosvāmī}} & 
    {\dat 13} {\ti \textbf{Disapp.:} Śrī Jayadeva Gosvāmī}  &  
    {\dat 14} {\ti \textbf{Disapp.:} Śrī Locana Dāsa Ṭhākūra, Makara Śaṅkrāntī} & 
    {\dat 15} {\ti }\\ 
    &  &  &  &  &  &  \\  &  &  &  &  &  & \\ \hline
    {\dat 16}  & 
    {\dat 17}  & 
    {\dat 18} \textbf{Ṣaṭ-tila Ekādaśī} & 
    {\dat 19} {\ti [07:03 - 10:49]} & 
    {\dat 20} & 
    {\dat 21} & 
    {\dat 22} \\ 
    &  &  &  &  &  &  \\  &  &  &  &  &  & \\ \hline
\end{tabularx}
\end{document}

输出

答案1

正如@DavidCarlisle 已经在几条评论中指出的那样,您需要\raggedright在列定义中添加。正确使用\fontsize要求第二个参数至少与第一个参数一样大,通常比第一个参数大约大 20%。

在此处输入图片描述

\documentclass[12pt]{article}
\usepackage{tabularx}
\usepackage[a4paper,landscape,margin=1cm]{geometry}
\usepackage{microtype}
\usepackage{fancyhdr}

\pagestyle{fancy}
\fancyhf{}

\usepackage{polyglossia}
\setmainfont{Linux Libertine O}

\newcolumntype{L}{>{\Large\raggedright\arraybackslash}X}
\newcommand{\ti}{\fontsize{14}{17}\selectfont }
\newcommand{\wday}{\bfseries \fontsize{15}{18}\selectfont}
\newcommand{\dat}{\bfseries  \fontsize{15}{18}\selectfont}

\begin{document}
\begin{center}
\Huge \textbf{JANUARY}
\end{center}

\noindent
\begin{tabularx}{\textwidth}{@{\rule[-2ex]{0pt}{5ex}} |*{7}{L|}}
    \hline
    \wday MON & \wday TUE & \wday WED & \wday THU & 
    \wday FRI & \wday SAT & \wday SUN   \\ \hline 
    {\dat  2} \textbf{Putradā Ekādaśī}   & 
    {\dat  3} \ti [06:59--10:44]; \textbf{App.}  Śrī Jagadīśa  Paṇḍita & 
    {\dat  4} {\ti } & 
    {\dat  5} {\ti } & 
    {\dat  6} \ti Śrī Kṛṣṇa Puṣya Abhiśeka     &
    {\dat  7} \ti \textbf{Māga māsa begins}& 
    {\dat  8} {\ti } \\ 
    &  &  &  &  &  & \\  
    &  &  &  &  &  & \\ \hline
    {\dat  9} {\ti } & 
    {\dat 10} {\ti } & 
    {\dat 11} {\ti } & 
    {\dat 12} {\ti [footnote]\footnote{%
    \textbf{Disapp.:} Śrī Rāmacandra Kavirāja; 
    \textbf{App.:} Śrīla Gopāla Bhaṭṭa Gosvāmī}} & 
    {\dat 13} \ti \textbf{Disapp.:} Śrī Jayadeva Gosvāmī  &  
    {\dat 14} \ti \textbf{Disapp.:} Śrī Locana Dāsa Ṭhākūra, Makara Śaṅkrāntī & 
    {\dat 15} {\ti } \\ 
    &  &  &  &  &  & \\  
    &  &  &  &  &  & \\ \hline
    {\dat 16} & 
    {\dat 17} & 
    {\dat 18} \textbf{Ṣaṭ-tila Ekādaśī} & 
    {\dat 19} \ti [07:03--10:49] & 
    {\dat 20} & 
    {\dat 21} & 
    {\dat 22} \\ 
    &  &  &  &  &  & \\  
    &  &  &  &  &  & \\ \hline
\end{tabularx}
\end{document}

相关内容