Closed stenskjaer closed 7 years ago
Custom commands would be great!
As also discussed in the thread, I'd suggest to include at least some more of the most frequent commands as allowed by default:
\edindex
, \index
and its more flexible variant as supplied by the index
and imakeidx
-packagesbabel
's and polyglossia
's language-switches, mainly \foreignlanguage
and \text⟨lang⟩
which can occur virtually everywhere in an editionAre the index commands currently a problem? As I understand it, it should only be a problem with macros that change the font properties.
That's a bit strange:
\documentclass{article}
\usepackage[series={A},nofamiliar,noeledsec,noledgroup]{reledmac}
\usepackage{makeidx}
\makeindex
\begin{document}
\beginnumbering
\pstart
Han var sonr
\edtext{\sameword[1]{Hákonar\index{Håkon II} konungs}}%
{\Afootnote{k\emph{on}gſ hakon\emph{ar} Sk}}%
, sons \sameword{Hákonar\index{Håkon I} konungs}
\pend
\endnumbering
\end{document}
will compile with pdflatex
or lualatex
-- but with the obvious problem, that \index
isn't ignored completely and that the sameword-counter thus will not be set correctly.
But with xelatex
it doesn't compile at all:
Writing index file indexsw.idx
(./indexsw.aux) ABD: EverySelectfont initializing macros Section 1 (./indexsw.1
./indexsw.1:5: Undefined control sequence.
\\ ->\let \reserved@e
\relax \let \reserved@f \relax \@ifstar {\let \reserv...
l.5 ]
?
Process aborted
the most complex point is the fact that \edindex can have an optional argument.
I will ask help to SE
please try issue668 branch.
It add swnoexpands
command, which can be completed with \appto
.
It contains newdefinition for \index
, \edindex
and language switching command.
Cf. ecbdf3c0
Okay. I just tested issue668 branch, and the indexing seems to work for me here (@floriandk, do you agree?).
I also tried creating a custom command with the following mwe:
\documentclass{article}
\usepackage[series={A},nofamiliar,noeledsec,noledgroup]{reledmac}
\usepackage{polyglossia}
\setmainlanguage{french}
\setotherlanguage{english}
\usepackage{makeidx}
\makeindex
\newcommand{\somemacro}[1]{}
\makeatletter
\appto{\swnoexpands}{%
\let\somemacro\@firstofone%
}
\makeatother
\begin{document}
\beginnumbering
\pstart
Han var sonr \edtext{\sameword[1]{Hákonar\somemacro{Håkon II}\textenglish{sncf} konungs}}%
{\Afootnote{k\emph{on}gſ hakon\emph{ar} Sk}}%
, sons \sameword{Hákonar\somemacro{Håkon I}\textenglish{sncf} konungs}
\pend
\endnumbering
\end{document}
When I do that, it does not compare the samewords correctly. I am probably doing something wrong, but can you tell me what it is?
\@firstofone mean you want to return the first argument.
So the result is as in your first \sameword you get
HákonarHåkon IIsncf konungs
and in the second one
HákonarHåkon Isncf konungs
What you want, in reality, is to get nothing in place of \somemacro.
So \let\somemacro\@gobble
to get in the two cases
Hákonarsncf konungs
Le 7 août 2017 à 14:48, Michael Stenskjær Christensen notifications@github.com a écrit :
Okay. I just tested issue668 branch, and the indexing seems to work for me here (@floriandk, do you agree?).
I also tried creating a custom command with the following mwe:
\documentclass {article}
\usepackage [series={A},nofamiliar,noeledsec,noledgroup]{reledmac}
\usepackage {polyglossia}
\setmainlanguage {french}
\setotherlanguage {english}
\usepackage {makeidx}
\makeindex
\newcommand{\somemacro }[1]{}
\makeatletter \appto{\swnoexpands}{%
\let\somemacro\@firstofone%
}
\makeatother
\begin {document}
\beginnumbering \pstart
Han var sonr \edtext{\sameword[1]{Hákonar\somemacro{Håkon II}\textenglish{sncf} konungs}}%
{ \Afootnote{k\emph{on}gſ hakon\emph{ar} Sk}}%
, sons \sameword{Hákonar\somemacro{Håkon I}\textenglish {sncf} konungs}
\pend \endnumbering
\end{document} When I do that, it does not compare the samewords correctly. I am probably doing something wrong, but can you tell me what it is?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
Yes! That solves it. It is cool 👍 Should we add some description to the docs? Can I do anything? Proof-read, write a draft or something?
maybe writing a draft
I have added a draft. It may need to be rewritten to remove inaccuracies or wrong commands. See https://github.com/maieul/ledmac/pull/670
I have completed the draf. In reality, the problem happens will all not fully expansable macro. I have also corrected some typo.
I will publish it on CTAN when my computer will be ok.
I fix this issue and merge the branch in the release branch.
Should we add a command for to define an arbitrary list of macros which could be allowed in sameword. As @maieul says in the discussion in https://github.com/stenskjaer/samewords/issues/7:
But as it could be macro with one or more argument, the user should have to do it own
\let
command.For example you should have to do