ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* automatic footnote rule in MKIV
@ 2009-02-21 16:13 Ilda Khaki
  2009-02-23 11:03 ` Hans Hagen
  0 siblings, 1 reply; 2+ messages in thread
From: Ilda Khaki @ 2009-02-21 16:13 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 4397 bytes --]

as I said before, in Persian we have two footnotes, one for Persian and the
other for English, if the first footnote in a pageis English, then footnote
rule will appear on left hand side and if the first footnote in a pgeis
persian, the footnote appears on right .
handside.

this is the code taken from xepersian which does automatic footnoterule, it
produces a file-name.fot


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%
%
                                    %                               footnote
setup                                        %

%
%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\ifx \CatEscape\undefined
    \chardef\CatEscape=0
    \chardef\CatOpen=1
    \chardef\CatClose=2
    \chardef\CatIgnore=9
    \chardef\CatLetter=11
    \chardef\CatOther=12
    \chardef\CatActive=13        % is defined in Plain already

    \chardef\CatUsCode=\catcode`\_
\fi

\catcode`\_=\CatLetter            % top level macro file


\def\r@fn{%
  \hbox to \columnwidth
  {\beginR \vbox{\kern -3\p@
   \hrule width .4\columnwidth \kern2.6\p@}\hfil\endR}}
\def\l@fn{%
   \hrule width .4\columnwidth\kern 2.6\p@}


\def\@makefnmark{\hbox{$^{\hbox{\scriptsize\@thefnmark}}\m@th$}}


\def\leftfootnoterule{\global\def\footnoterule{\l@fn}}
\def\rightfootnoterule{\global\def\footnoterule{\r@fn}}
\leftfootnoterule

%%% \beginprog
\newread\old_foot_file
\newwrite\foot_file
\def\foot_file_name{\jobname.fot\relax}
\def\init_footnote{%
   \openin\old_foot_file\foot_file_name
   \ifeof\old_foot_file  \closein\old_foot_file
   \else  \closein\old_foot_file
      \read_foot_file
   \fi
   \immediate\openout\foot_file\foot_file_name
   \immediate\write\foot_file{\relax}%
   \global\let\init_footnote\relax
   }

\newcount\foot_name_no  % for generating footnote mark names





\newcount\autofootnote
\def\fnpp_next_footnote{%
    \init_footnote
    \global\advance\foot_name_no\@ne
    \global\advance\c@footnote\@ne
    \edef\do_write{%
    \immediate\write\foot_file{%
        \string\advance\autofootnote\@ne
        \string\expandafter\xdef
            \string\csname\space f@\number\foot_name_no \endcsname{%
        \string\number\autofootnote
        }%
        }%
    }%
    \do_write
    \global\autofootnote 0\csname f@\number\foot_name_no \endcsname \relax
    }

\def\read_foot_file{%
   \begingroup
      \catcode`\@\CatLetter \catcode`\^^M\CatIgnore
      \input \foot_file_name
   \endgroup
   }

\let\fnpp_orig_outputpage=\@outputpage
\def\@outputpage{%
    \ifx \init_footnote\relax
    \immediate\write\foot_file{\autofootnote\z@}%
    \fi
    \fnpp_orig_outputpage
    }

\let\FnppOrigFootnote=\footnote        % save original bindings
\let\FnppOrigFootnotemark=\footnotemark

\def\footnote{%
    \@ifnextchar[%            % ] (Emacs)
    \@xfootnote
    {\fnpp_next_footnote \ifnum\autofootnote=1\rightfootnoterule\fi
\@xfootnote[\the\c@footnote] %
}%
    }
\def\footnotemark{%
    \@ifnextchar[%            % ] (Emacs)
    \@xfootnotemark
    {\fnpp_next_footnote \ifnum\autofootnote=1\rightfootnoterule\fi
\@xfootnotemark[\the\c@footnote]}%
    }




\def\footnotemarkLR{%
    \@ifnextchar[%            % ] (Emacs)
    \@xfootnotemark
    {\fnpp_next_footnote
\ifnum\autofootnote=1\leftfootnoterule\fi\@xfootnotemark[\the\c@footnote]}%
    }

\newif\if@RomanFootNum
\providerobustcmd{\Footnote}[1]{%
\bgroup
\footnotemarkLR%
\renewcommand{\thefootnote}{\if@RomanFootNum\rmfamily{\@arabic\c@footnote
}\else\@arabic\c@footnote\fi}%
\@RTLfalse\footnotetext{\rmfamily#1}%
\egroup
}
\@RomanFootNumfalse
\def\PersianFootNum{\@RomanFootNumfalse}
\def\RomanFootNum{\@RomanFootNumtrue}
\DeclareOption{RomanFootNum}{\@RomanFootNumtrue}
\ProcessOptions



\ifx \@minipagerestore\relax
    \let\@minipagerestore\@empty
\fi

\g@addto@macro\@minipagerestore{%
    \let\footnote\FnppOrigFootnote
    }

\let\fnpp_orig_maketitle=\maketitle
\def\maketitle{%
    \begingroup
        \let\footnotemark\FnppOrigFootnotemark
    \fnpp_orig_maketitle
    \endgroup
    }

\catcode`\_=\CatUsCode


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%
%
                                    %                            End of
footnote setup                                    %

%
%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

[-- Attachment #1.2: Type: text/html, Size: 10925 bytes --]

[-- Attachment #2: Type: text/plain, Size: 487 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: automatic footnote rule in MKIV
  2009-02-21 16:13 automatic footnote rule in MKIV Ilda Khaki
@ 2009-02-23 11:03 ` Hans Hagen
  0 siblings, 0 replies; 2+ messages in thread
From: Hans Hagen @ 2009-02-23 11:03 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Ilda Khaki wrote:
> as I said before, in Persian we have two footnotes, one for Persian and the
> other for English, if the first footnote in a pageis English, then footnote
> rule will appear on left hand side and if the first footnote in a pgeis
> persian, the footnote appears on right .
> handside.

you mean the rule?

[rule]
1-english
                      persian-2

vs

                         [rule]
                      persian-1

2-english

and so?


> this is the code taken from xepersian which does automatic footnoterule, it
> produces a file-name.fot

since i'm not familiar with latex it's hard for me to decipher such 
code; best is to define precisely what you expect as often there's a way 
to configure things in context of to use already present low level 
mechanisms

Hans


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-02-23 11:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-21 16:13 automatic footnote rule in MKIV Ilda Khaki
2009-02-23 11:03 ` Hans Hagen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).