1

I am trying to create a calendar with tabularx package. I managed to get the tables right but there seems to be a lot of space between the words and between the lines. It reminds me of MS Word document in justified alignment, wherein unnecessary spaces between words appear out of nowhere.

Question:

  1. How can I reduce the line spacing and get rid of the spaces between words? [That will give me some space to include two more rows for two more weeks.]
  2. Is there anything that I am doing wrong? [Of course, I am not sure if this the right method to create a calendar.]

I have quite some text to include within each "box", as it can be seen from the MWE and the screen shot of the PDF output. [I don't know why a line appears on top of "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}

OUTPUT

4
  • you are justfying use \newcolumntype{C}{>{ \Large}\raggedright \arraybackslash}X} Commented Nov 29, 2022 at 12:39
  • \fontsize{15}{11}\selectfont} ???? 15pt font on lines 11pt apart? Commented Nov 29, 2022 at 12:39
  • @DavidCarlisle Is {15}{11} a cause of weird spaces? What should be the parameter? Can you please explain?
    – vrgovinda
    Commented Nov 29, 2022 at 13:09
  • raggedright as in first comment will fix the spacing, your fontsize calls are just weird, why not use \large ? it is almost always wrong for the second argument to be less than the first but better to use one of the named sizes Commented Nov 29, 2022 at 13:19

1 Answer 1

1

As @DavidCarlisle has already noted in a couple of comments, you need to added \raggedright in the column definition. Proper usage of \fontsize requires the second argument to at least as large as, and generally about 20% larger than, the first argument.

enter image description here

\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}
10
  • \usepackage[latvian]{babel} % is this correct? No. This is IAST [International Alphabet for Sanskrit Transliteration]. Generally, I don't use babel. polylossia does the job nicely.
    – vrgovinda
    Commented Nov 29, 2022 at 13:13
  • @VrajarajaGovindaDas - Thanks for providing this correction; I've reverted the code to loading polyglossia instead of babel. Note that since your code doesn't define a main or default language, loading polyglossia amounts to just loading the fontspec package.
    – Mico
    Commented Nov 29, 2022 at 13:20
  • Yeah. There's wasn't a need to define a main or default language since the alphabets are Roman, isn't it?
    – vrgovinda
    Commented Nov 29, 2022 at 13:38
  • Thanks. Your code works. I see that you have changed C to L in this line. \newcolumntype{L}{>{\Large\raggedright\arraybackslash}X}, Does that indicate left aligned and center aligned respectively?
    – vrgovinda
    Commented Nov 29, 2022 at 13:41
  • 1
    @VrajarajaGovindaDas - The LaTeX kernel sets up the l, c, r, and p column types. (The p stands for paragraph.) These are not just "variable names" that can be assigned to any column type. Various packages define additional column types. E.g., the tabularx and dcolumn packages define the X and D column types, respectively. Given that the letters l, c, and r are taken, I think it's good practice to use "free" or previously unassigned lowercase and uppercase letters carefully and in (mild) conformance with the existing naming patterns.
    – Mico
    Commented Dec 1, 2022 at 2:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .