How to align calendar with week number as intermonth text

When I use the Emacs calendar / diary with org-mode (however, I do not think this is the cause of the problem), I encounter the following problem.

The default calendar looks like this:

calendar

I add the following codes to display the week number:

(copy-face font-lock-constant-face 'calendar-iso-week-face) (set-face-attribute 'calendar-iso-week-face nil :height 1) (setq calendar-intermonth-text '(propertize (format "%2d" (car (calendar-iso-from-absolute (calendar-absolute-from-gregorian (list month day year))))) 'font-lock-face 'calendar-iso-week-face)) ; Title for week number (copy-face 'default 'calendar-iso-week-header-face) (set-face-attribute 'calendar-iso-week-header-face nil :height 0.7) (setq calendar-intermonth-header (propertize "Wk" ; or eg "KW" in Germany 'font-lock-face 'calendar-iso-week-header-face)) 

After entering these codes, week numbers can be displayed. However, alignment is a bit strange:

The last line of the calendar is not aligned. How to deal with this problem?

Thanks.

+8
emacs calendar org-mode
source share
1 answer

These are your height settings that are causing the problem. You can try experimenting with other variables, such as: calendar-left-margin , calendar-column-width , calendar-day-header-width , calendar-day-digit-width , calendar-intermonth-header , calendar-intermonth-text .

NOTE. For those who are wondering how to highlight Saturday instead of Monday, the calendar-generate-month function has a line of code that contains (if (memq i '(0 6)) - if calendar-week-start-day changed from 0 to 1 then it would be necessary to change the above code from 0 6 to 5 6 Alternatively, the font lock settings can be focused by adding new keywords on the days of the week.

 (setq calendar-week-start-day 1) (setq calendar-intermonth-text '(propertize (format "%2d" (car (calendar-iso-from-absolute (calendar-absolute-from-gregorian (list month day year))))) 'font-lock-face 'font-lock-warning-face)) (setq calendar-intermonth-header (propertize "Wk" ; or eg "KW" in Germany 'font-lock-face 'font-lock-keyword-face)) 

Example http://www.lawlist.com/images/calendar-example.png

+6
source share

All Articles