Re: [XeTeX] Automate table creation
> I tried runing your code, but I get the following message: > > ! Missing number, treated as zero. > >* > l.20 \maketable{c,0}{1,2} I knew I should've tested that code. \documentclass{article} \usepackage{xparse} \usepackage{array} \ExplSyntaxOn \DeclareDocumentCommand{\maketable}{mm} { \exp_args:Nnx \begin{tabular}{c*{\clist_length:n{#2}}c} \clist_map_inline:nn {#2} { & \typeset_two:n {##1} } \clist_map_inline:nn {#1} { \\ \typeset_one:n {##1} \clist_map_inline:nn {#2} { & \typeset_both:nn {##1} {1} } } \end{tabular} } \cs_new_protected:Npn \typeset_one:n #1 { [#1] } \cs_new_protected:Npn \typeset_two:n #1 { (#1) } \cs_new_protected:Npn \typeset_both:nn #1#2 {#1#2} \ExplSyntaxOff \begin{document} \maketable{0,1}{a,b,c} \end{document} works. The previous code was mostly missing \usepackage{array} for the "*{}c" construction, and had a bunch of other bugs. To customize that, change the definition of the three functions \typeset_one:n, \typeset_two:n and \typeset_both:n. Building diacritics from the base accent and the character seems a bit tougher than I thought. Others on this thread will know how to do that. Cheers, Bruno -- Subscriptions, Archive, and List information, etc.: http://tug.org/mailman/listinfo/xetex
Re: [XeTeX] Automate table creation
Here another basis on which you might be able to auto-generate your tables, once you adopt it to your needs. Strategy: First create a command that contains the whole table, then afterwards call that command to actually output the table. \documentclass{article} \usepackage{pgffor} \usepackage{etoolbox} \begin{document} % create tabular head: \newcommand{\TABLE}{\begin{tabular}{}} % add lines using a loop (you can use nested loops if need be; use % \noexpand to protect commands that should not yet be expanded): \foreach \n in {a,b,c}{\xappto{\TABLE}{\n & \noexpand\`\n & \noexpand\'\n & \noexpand\"\n \noexpand\\}} % add the tabular foot: \xappto{\TABLE}{\noexpand\end{tabular}} % execute the tabular: \TABLE \end{document} I hope that helps, Susan PS: Idea taken from http://tex.stackexchange.com/questions/15517/generating-tables-with-for-command -- Subscriptions, Archive, and List information, etc.: http://tug.org/mailman/listinfo/xetex
Re: [XeTeX] Automate table creation
Bruno Le Floch writes: >> [code snippet] I tried runing your code, but I get the following message: ! Missing number, treated as zero. * l.20 \maketable{c,0}{1,2} Aleksandr -- Subscriptions, Archive, and List information, etc.: http://tug.org/mailman/listinfo/xetex
Re: [XeTeX] Automate table creation
2012/3/1 Bruno Le Floch : > As Tobias mentions, use a package for loops. I think the code below > should work, but I don't know how to build diacritics on a letter: > isn't the point of combining marks that just putting the two > characters next to each other should do the trick? I didn't test. > It depends on how the font is built. First, the accent must not be centered geometrically but optically. Moreover, you cannot just build the characters from the base character and an accent, it was shown by typographers centuries ago. you need at least a different accent for lowercase and different for uppercase letters. you can see it on high quality commercial fonts from www.stormtype.com (Czech fonts by F. Štorm). The accented characters should preferably be drawn as glyphs. Substitution of a combining diacritical mark + base letter to an accented letter can be achieved by GSUB tables but I am not sure whether such tables exist in all fonts. You can also switch the Unicode normalization in XeTeX, it should probably work too. > \documentclass{article} > \usepackage{xparse} > \ExplSyntaxOn > \DeclareDocumentCommand{\maketable}{mm} > { > \use:x { \noexpand\begin{tabular}{*{\clist_length:n{#2}}} } > \clist_map_inline:nn {#2} { & ##1 } > \clist_map_inline:nn {#1} > { > \\ > ##1 > \clist_map_inline:nn {#2} > { & \build_diacritic:nn {##1} {1} } > } > \end{tabular} > } > \cs_new_protected:Npn \build_diacritic:nn #1#2 {#1#2} % dunno? > \ExplSyntaxOff > \begin{document} > \maketable{^,`}{a,b,c} > \end{document} > > On 3/1/12, Tobias Schoel wrote: >> Look for looping packages, e.g. multido and pgffor. pgffor's foreach >> command seems to be quite suitable, except I haven't yet made it work >> inside tabulars. >> >> On 01.03.2012 04:27, Aleksandr Andreev wrote: >>> Hello everybody, >>> >>> I am wondering if someone could guide me as to how to create a macro >>> in XeTeX that will do the following. >>> >>> Background: I'm creating some files that demonstrate whether or not >>> OpenType features are correctly implemented in a font (for now, I am >>> only concerned with the correct positioning of diacritics). For this, >>> I would like to create a set of tables. >>> Across the columns of the table, I will have the diacritic marks; for >>> illustrative purposes, let's say they are U+0300, U+0301 and U+0311, >>> etc. (the actual file will have about 20 such marks) >>> >>> Down the rows, I am putting characters, say U+0410 (Cyrillic A), >>> U+0415 (Cyrillic Ie), etc, about 50 total, not necessarily contiguous >>> within Unicode. >>> >>> In each cell of the Table, all I need is to combine the character and >>> the diacritic. >>> >>> So, for example, I'll have: >>> >>> begin{tabular} >>> & ̀& ́ \\ >>> A& À& Á \\ >>> etc. >>> >>> Here's the question: is there any way to write a TeX macro to build >>> this table automatically -- i.e., I feed it the list of characters and >>> diacritics, and it creates the Table? Basically, I'm being lazy and >>> not wanting to type out the entire 50x20 table. >>> >>> Thanks! >>> >>> Aleksandr > > > > -- > Subscriptions, Archive, and List information, etc.: > http://tug.org/mailman/listinfo/xetex -- Zdeněk Wagner http://hroch486.icpf.cas.cz/wagner/ http://icebearsoft.euweb.cz -- Subscriptions, Archive, and List information, etc.: http://tug.org/mailman/listinfo/xetex
Re: [XeTeX] Automate table creation
As Tobias mentions, use a package for loops. I think the code below should work, but I don't know how to build diacritics on a letter: isn't the point of combining marks that just putting the two characters next to each other should do the trick? I didn't test. \documentclass{article} \usepackage{xparse} \ExplSyntaxOn \DeclareDocumentCommand{\maketable}{mm} { \use:x { \noexpand\begin{tabular}{*{\clist_length:n{#2}}} } \clist_map_inline:nn {#2} { & ##1 } \clist_map_inline:nn {#1} { \\ ##1 \clist_map_inline:nn {#2} { & \build_diacritic:nn {##1} {1} } } \end{tabular} } \cs_new_protected:Npn \build_diacritic:nn #1#2 {#1#2} % dunno? \ExplSyntaxOff \begin{document} \maketable{^,`}{a,b,c} \end{document} On 3/1/12, Tobias Schoel wrote: > Look for looping packages, e.g. multido and pgffor. pgffor's foreach > command seems to be quite suitable, except I haven't yet made it work > inside tabulars. > > On 01.03.2012 04:27, Aleksandr Andreev wrote: >> Hello everybody, >> >> I am wondering if someone could guide me as to how to create a macro >> in XeTeX that will do the following. >> >> Background: I'm creating some files that demonstrate whether or not >> OpenType features are correctly implemented in a font (for now, I am >> only concerned with the correct positioning of diacritics). For this, >> I would like to create a set of tables. >> Across the columns of the table, I will have the diacritic marks; for >> illustrative purposes, let's say they are U+0300, U+0301 and U+0311, >> etc. (the actual file will have about 20 such marks) >> >> Down the rows, I am putting characters, say U+0410 (Cyrillic A), >> U+0415 (Cyrillic Ie), etc, about 50 total, not necessarily contiguous >> within Unicode. >> >> In each cell of the Table, all I need is to combine the character and >> the diacritic. >> >> So, for example, I'll have: >> >> begin{tabular} >> & ̀& ́ \\ >> A& À& Á \\ >> etc. >> >> Here's the question: is there any way to write a TeX macro to build >> this table automatically -- i.e., I feed it the list of characters and >> diacritics, and it creates the Table? Basically, I'm being lazy and >> not wanting to type out the entire 50x20 table. >> >> Thanks! >> >> Aleksandr -- Subscriptions, Archive, and List information, etc.: http://tug.org/mailman/listinfo/xetex
Re: [XeTeX] Automate table creation
Look for looping packages, e.g. multido and pgffor. pgffor's foreach command seems to be quite suitable, except I haven't yet made it work inside tabulars. On 01.03.2012 04:27, Aleksandr Andreev wrote: Hello everybody, I am wondering if someone could guide me as to how to create a macro in XeTeX that will do the following. Background: I'm creating some files that demonstrate whether or not OpenType features are correctly implemented in a font (for now, I am only concerned with the correct positioning of diacritics). For this, I would like to create a set of tables. Across the columns of the table, I will have the diacritic marks; for illustrative purposes, let's say they are U+0300, U+0301 and U+0311, etc. (the actual file will have about 20 such marks) Down the rows, I am putting characters, say U+0410 (Cyrillic A), U+0415 (Cyrillic Ie), etc, about 50 total, not necessarily contiguous within Unicode. In each cell of the Table, all I need is to combine the character and the diacritic. So, for example, I'll have: begin{tabular} & ̀& ́ \\ A& À& Á \\ etc. Here's the question: is there any way to write a TeX macro to build this table automatically -- i.e., I feed it the list of characters and diacritics, and it creates the Table? Basically, I'm being lazy and not wanting to type out the entire 50x20 table. Thanks! Aleksandr -- Subscriptions, Archive, and List information, etc.: http://tug.org/mailman/listinfo/xetex -- Subscriptions, Archive, and List information, etc.: http://tug.org/mailman/listinfo/xetex
Re: [XeTeX] selecting font variants
Don, The following works for me using a Mac, not sure if you can access the font glyphs this way in other systems: - \itshape testing the \XeTeXglyph3\ and the \XeTeXglyph4 -- What you want is \XeTeXglyph4, present in the italic font, but apparently there is no Unicode point for it, and that is why we use \XeTeXglyph to access it. Alternatively, more complicated and suboptimal, you can check the fontspec manual for this kind of solution: {\fontspec[FakeSlant=0.2]{Charis SIL} a} I suppose the main issue here would be to take care of the nesting so that you can keep the Roman shape inside an italicised context. Or maybe select the font more specifically as Charis SIL-R. But the above solution is the best, as it makes use of a character actually within Charis Italic. Re fonts: I think Junicode also covers the IPA range. All the best, Juan -- Subscriptions, Archive, and List information, etc.: http://tug.org/mailman/listinfo/xetex