emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: cal-tex.el landscape patch


From: Vincent Belaïche
Subject: RE: cal-tex.el landscape patch
Date: Sat, 26 Aug 2017 15:29:34 +0000

Hello,

Here is the my updated patch, and below the change log. If every body agrees I can commit/push the change.


I have also made a4paper a default option, because if in the future we want to support other paper sizes, and the cellwidth and so on computed by LaTeX code based on \papwerwidth, then the paper size has to be specified always.


ChangeLog :

    * lisp/calendar/cal-tex.el (cal-tex-preamble): Make 12pt the
    default class option. Passing no option, not even an empty
    option list, can still be done by passing `t' for args.
    (cal-tex-year, cal-tex-cursor-month-landscape): Pass landscape
    request to `cal-tex-insert-preamble' function call within the
    class option string.
    (cal-tex-cursor-month): Don't pass any longer "12pt" argument
    to `cal-tex-insert-preamble' function, as it is default.
    (cal-tex-insert-preamble): Suppress landscape and size
    argument, and replace them by a class-options string
    argument. Do not insert any longer "\special{landscape}" in
    case of landscape layout, as the job is made by the geometry
    package.
    (cal-tex-cursor-week): Don't pass any longer "12pt" argument
    to `cal-tex-preamble' function, as it is default.


De : Vincent Belaïche <address@hidden>
Envoyé : samedi 26 août 2017 17:06:46
À : Edward Reingold; Glenn Morris
Cc : emacs-devel
Objet : RE: cal-tex.el landscape patch
 

That is a great idea. The LaTeX code generated by cal-tex.el could have some formatter macro defined by \providecommand as identity by default. Then the user could change the definition by inserting some custom LaTeX code that would for instance define the formatter as #1->\textcolor{red}{#1}.


Another idea is that the code generator for the diary could cusotomized to use OrgMode translation instead of cal-tex-LaTeXify-string, so you would write in the diary an entry as :


@@latex:\textcolor{red}{@@My important appointment@@latex:}@@


This second idea would make it easier to have different colors or formatting for different items.


   Vincent.


De : Edward Reingold <address@hidden>
Envoyé : vendredi 25 août 2017 20:25:51
À : Glenn Morris; Vincent Belaïche
Cc : emacs-devel
Objet : Re: cal-tex.el landscape patch
 
I would add easy optional use of colors for, say, holidays (red) and/or diary entries (blue). 

 Fri, Aug 25, 2017 at 12:59 PM Vincent Belaïche <address@hidden> wrote:

Oops... sorry for my mistake, class-options is not optional in cal-tex-insert-preamble. I will make it options as you suggest.


  Vincent.


De : Vincent Belaïche <address@hidden>
Envoyé : vendredi 25 août 2017 11:07
À : Glenn Morris
Cc : emacs-devel
Objet : RE: cal-tex.el landscape patch
 

Answers below.


De : Glenn Morris <address@hidden>
Envoyé : vendredi 25 août 2017 03:10
À : Vincent Belaïche
Cc : emacs-devel
Objet : Re: cal-tex.el landscape patch
>
>
>Fine by me, thanks. Trivial comments below.
>
>> -(defun cal-tex-preamble (&optional args)
>> +(defun cal-tex-preamble (&optional class-options)
>>    "Insert the LaTeX calendar preamble into `cal-tex-buffer'.
>>  Preamble includes initial definitions for various LaTeX commands.
>> -Optional string ARGS are included as options for the article document class."
>> +Optional string CLASS-OPTIONS are included as options for the article document class."
>>    (set-buffer (generate-new-buffer cal-tex-buffer))
>>    (insert (format "\\documentclass%s{article}\n"
>> -                  (if (stringp args)
>> -                      (format "[%s]" args)
>> +                  (if (stringp class-options)
>> +                      (format "[%s]" class-options)
>>                      "")))
>> +  (if (and (stringp class-options) (string-match "\\<landscape\\>" class-options))
>> +      (insert "\\usepackage{geometry}\n"))
>
>
>I'd prefer if the argument did not get renamed.

No problem, I will revert the prior name.
>
>
>> -(defun cal-tex-insert-preamble (weeks landscape size &optional append)
>> +(defun cal-tex-insert-preamble (weeks class-options &optional append)
>>    "Initialize the output LaTeX calendar buffer, `cal-tex-buffer'.
>>  Select the output buffer, and insert the preamble for a calendar
>> -of WEEKS weeks.  Insert code for landscape mode if LANDSCAPE is
>> -non-nil.  Use point-size SIZE.  Optional argument APPEND, if
>> -non-nil, means add to end of buffer without erasing current contents."
>> -  (let ((width "18cm")
>> +of WEEKS weeks.  Insert code for landscape mode if CLASS-OPTIONS
>> +contains landscape option.
>> +Optional argument APPEND, if non-nil, means add to end of buffer
>> +without erasing current contents."
>
>"Insert code for landscape mode if CLASS-OPTIONS contains landscape
>option." seems a bit vague to me. Maybe something like
>
>"Pass string CLASS-OPTIONS as options for the article document class.
>If it contains \"landscape\", use the geometry package to produce
>landscape format."

You are fully right, your proposed docstring is quite more clear. I will
take it.
>
>Maybe class-options could be optional, and default to "12pt"?
>
It is already optional, I will make it default to "12pt", that is a good
idea.

  Vincent

Attachment: cal-tex-1.diff.txt
Description: cal-tex-1.diff.txt


reply via email to

[Prev in Thread] Current Thread [Next in Thread]