LaTeX forum ⇒ Document ClassesHow to put date on top-left under letter class? Topic is solved

Information and discussion about specific document classes and how to create your own document classes.
User avatar
Cham
Posts: 904
Joined: Sat Apr 02, 2011 4:06 pm

How to put date on top-left under letter class?

Postby Cham » Tue Mar 05, 2019 5:27 pm

I'm having a problem with the date position under the letter class. Here's a MWE code to show the problem:
  1. \documentclass[11pt,letterpaper]{letter}
  2. \usepackage[T1]{fontenc}
  3. \usepackage[letterpaper,top=1in]{geometry}
  4. \usepackage{charter}
  5.  
  6. \begin{document}
  7.  
  8. \date{\begin{flushleft}\today\end{flushleft}} % Use todays date and left-align it
  9.  
  10. \begin{letter}{To someone}
  11.  
  12. \begin{center}
  13. \Large\textsc{sue letter}
  14. \end{center}
  15.  
  16. \signature{Bob Doe}
  17.  
  18. \opening{Hello.}
  19. Blabla bla bla.
  20. \closing{Yours,}
  21.  
  22. \end{letter}
  23.  
  24. \end{document}


Here's a preview and what I need to do (in red) :
letter.jpg
letter.jpg (18.58 KiB) Viewed 726 times


So how can I move the date in the upper-left corner, while moving the title under the date? This should be very easy but I don't get it. :oops:

User avatar
Cham
Posts: 904
Joined: Sat Apr 02, 2011 4:06 pm

Postby Cham » Thu Mar 07, 2019 4:01 pm

I solved my issue by using this code, but it seems odd to me. Is there a better solution for this?

  1. \documentclass[11pt,letterpaper]{letter}
  2. \usepackage[T1]{fontenc}
  3. \usepackage[letterpaper,top=1in]{geometry}
  4. \usepackage{charter}
  5.  
  6. \begin{document}
  7.  
  8. \date{\begin{flushleft}\today\end{flushleft}}
  9. \signature{Bob Doe}
  10.  
  11. \begin{letter}{{\hfill\Large\textsc{sue letter}\hfill} \bigskip \\ \textbf{Someone} \\ Address}
  12.  
  13. \opening{Hello.}
  14.  
  15. Blabla bla bla.
  16.  
  17. \closing{Yours,}
  18.  
  19. \end{letter}
  20.  
  21. \end{document}


If I remove the \bigskip command, the "sue letter" title is flushed to the right. What am I doing wrong here?

User avatar
Stefan Kottwitz
Site Admin
Posts: 9419
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Thu Mar 07, 2019 11:43 pm

Hi Cham,

good that you found a way! Well, one can use such a workaround, or patch letter class macros. It's probably not worth the effort if there's a simple way.

To enforce the \hfill that may not be done at the end of a line, you can use \hspace*{\fill}:

\begin{letter}{{\hfill\Large\textsc{sue letter}\hspace*{\fill}}

Stefan
Site admin


Return to “Document Classes”

Who is online

Users browsing this forum: No registered users and 1 guest