Difference between \skip and \unskip
Hullo, can someone tell me what's the difference between \skip and \unskip and when to use them? I've already checked the wiki and the references, but cannot find a definition of either. Here's a use case that's giving me headaches for quite some time: In my bibliography I often have items that are missing one or two fields (e.g. legal texts with or without amendments etc.) and I have to tell ConTeXt to skip those. From trial and error I learnt that: * \skip leaves me with the punctuation and styling around the skipped field (e.g. a trailing ", ." or "( )") * \unskip seems to do what I want, but generates the following error every time 'context' reaches an '\unskip' entry: --8<------------------ l.1 ...al , št. \localissue /\localvolume \skip , \localspremembe . \currentnotedescriptiontext ...ptionnumberentry )} \handlenoteitself ... \currentnotedescriptiontext \endstrut \dostopstoreddes... \handlenoteinsert ...s }\handlenoteitself {#1}{#2} \egroup \the \everyafterno... \@@notemakedescription ...note \currentnotenumber \fi \fi \endgroup \fi \fi ... ... l.82 ...e Konvencija MOD št. 173\zakon[][MOD_173] (ter Priporočilo št. 18... ? help A number should have been here; I inserted `0'. (If you can't figure out why I needed to see a number, look up `weird error' in the index to The TeXbook.) ------------------>8-- The example code: --8<------------------ \def\zakon[#1][#2]% {\doifdefinedelse{zakonkratko:#2} {\zakonkratko[#1][#2]} {\bgroup \nocite[#2]% \getcitedata[title][#2] to \localtitle \getcitedata[kratko][#2] to \localkratko \getcitedata[journal][#2] to \localjournal \getcitedata[issue][#2] to \localissue \getcitedata[volume][#2] to \localvolume \getcitedata[spremembe][#2] to \localspremembe \footnote{\localtitle\ (\localkratko), \localjournal, št. \localissue/\localvolume\skip, \localspremembe.}% \egroup} \setvalue{zakonkratko:#2}{done} } \def\zakonkratko[#1][#2]% {\bgroup \nocite[#2]% \getcitedata[kratko][#2] to \localkratko \footnote{\skip#1 \localkratko.}% \egroup} \startpublication[k=MESL, t=zakon, y=1996 ] \title{Evropska socialna listina (spremenjena)} \kratko{MESL} \engtitle{European Social Charter (revised)} \organization{Svet Evrope} \journal{Ur. l. RS-MP} \volume{1999} \issue{7} \pubyear{1999}\month{04}\day{10} \yearfiled{1999}\monthfiled{04}\dayfiled{11} \biburl{http://www.uradni-list.si/1/objava.jsp?urlmpid=199920} \stoppublication ------------------>8-- -- gsm: +386 41 849 552 www: http://matija.suklje.name xmpp: matija.suklje@gabbler.org
On 3-11-2010 10:21, Matija Šuklje wrote:
Hullo,
can someone tell me what's the difference between \skip and \unskip and when to use them?
\skip <skip specification> : insert (flexible) glue \unskip : remove previous glue it's not so much different from \dress and \undress: you add something and \un* removes it Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
Dne sreda 3. novembra 2010 ob 10:32:25 je Hans Hagen napisal(a):
\skip <skip specification> : insert (flexible) glue \unskip : remove previous glue
it's not so much different from \dress and \undress: you add something and \un* removes it
…soooo, it's kind of like \start* \stop* embracing the content that should be skipped or not? pseudo-code: Some \entries I would, (\like) always and\skip, the \clever\unskip\skip (\bit) here\unskip. Cheers, Matija -- gsm: +386 41 849 552 www: http://matija.suklje.name xmpp: matija.suklje@gabbler.org
Am 03.11.2010 um 10:38 schrieb Matija Šuklje:
Dne sreda 3. novembra 2010 ob 10:32:25 je Hans Hagen napisal(a):
\skip <skip specification> : insert (flexible) glue \unskip : remove previous glue
it's not so much different from \dress and \undress: you add something and \un* removes it
…soooo, it's kind of like \start* \stop* embracing the content that should be skipped or not?
no, it’s about adding and removing space between words Wolfgang
Dne sreda 3. novembra 2010 ob 10:53:58 je Wolfgang Schuster napisal(a):
Am 03.11.2010 um 10:38 schrieb Matija Šuklje: no, it’s about adding and removing space between words
Oh, OK. :\ So, how do I skip missing bibliography fields and characters besides spaces that are part of the citing style? Cheers, Matija -- gsm: +386 41 849 552 www: http://matija.suklje.name xmpp: matija.suklje@gabbler.org
Am 03.11.2010 um 11:00 schrieb Matija Šuklje:
So, how do I skip missing bibliography fields and characters besides spaces that are part of the citing style?
You saved the values here in macros: \def\zakon[#1][#2]% {\doifdefinedelse{zakonkratko:#2} {\zakonkratko[#1][#2]} {\bgroup \nocite[#2]% \getcitedata[title][#2] to \localtitle \getcitedata[kratko][#2] to \localkratko \getcitedata[journal][#2] to \localjournal \getcitedata[issue][#2] to \localissue \getcitedata[volume][#2] to \localvolume \getcitedata[spremembe][#2] to \localspremembe \footnote{\localtitle\ (\localkratko), \localjournal, št. \localissue/\localvolume\skip, \localspremembe.}% \egroup}% \setvalue{zakonkratko:#2}{done}} You can check for content in these macros with: \doifsomething{\localtitle}{\localtitle} \doifsomethingelse{\localtitle}{\localtitle}{<something else>} \doifnothing{\localtitle}{<no title>} \doifelsenothing{\localtitle}{<no title>}{\localtitle} Wolfgang
On Wed, Nov 3, 2010 at 11:08, Wolfgang Schuster wrote:
Am 03.11.2010 um 11:00 schrieb Matija Šuklje:
So, how do I skip missing bibliography fields and characters besides spaces that are part of the citing style?
You saved the values here in macros:
\def\zakon[#1][#2]% {\doifdefinedelse{zakonkratko:#2} {\zakonkratko[#1][#2]} {\bgroup \nocite[#2]% \getcitedata[title][#2] to \localtitle \getcitedata[kratko][#2] to \localkratko \getcitedata[journal][#2] to \localjournal \getcitedata[issue][#2] to \localissue \getcitedata[volume][#2] to \localvolume \getcitedata[spremembe][#2] to \localspremembe \footnote{\localtitle\ (\localkratko), \localjournal, št. \localissue/\localvolume\skip, \localspremembe.}% \egroup}% \setvalue{zakonkratko:#2}{done}}
You can check for content in these macros with:
\doifsomething{\localtitle}{\localtitle} \doifsomethingelse{\localtitle}{\localtitle}{<something else>} \doifnothing{\localtitle}{<no title>} \doifelsenothing{\localtitle}{<no title>}{\localtitle}
But this is what the macros \setuppublicationlayout and \insertXYZ are already doing, right? Wouldn't it be easier to use those? Or is the problem that something needs to be cited multiple times (once in footnote and then again at the end of article)? Mojca
Dne sreda 3. novembra 2010 ob 11:13:01 je Mojca Miklavec napisal(a):
Am 03.11.2010 um 11:00 schrieb Matija Šuklje:
So, how do I skip missing bibliography fields and characters besides spaces that are part of the citing style?
You saved the values here in macros: […] But this is what the macros \setuppublicationlayout and \insertXYZ are already doing, right? Wouldn't it be easier to use those? Or is the
On Wed, Nov 3, 2010 at 11:08, Wolfgang Schuster wrote: problem that something needs to be cited multiple times (once in footnote and then again at the end of article)?
Each entry has to cited twice, yes — first in a shorter form in the footnote and then in the full form in the publications list at the end of the document. Cheers, Matija -- gsm: +386 41 849 552 www: http://matija.suklje.name xmpp: matija.suklje@gabbler.org
On 11/03/10 11:08, Wolfgang Schuster wrote:
Am 03.11.2010 um 11:00 schrieb Matija Šuklje:
So, how do I skip missing bibliography fields and characters besides spaces that are part of the citing style?
Adjust the style? Certainly that is easier than the macro solution I see below.
You saved the values here in macros:
\def\zakon[#1][#2]% {\doifdefinedelse{zakonkratko:#2} {\zakonkratko[#1][#2]} {\bgroup \nocite[#2]% \getcitedata[title][#2] to \localtitle \getcitedata[kratko][#2] to \localkratko \getcitedata[journal][#2] to \localjournal \getcitedata[issue][#2] to \localissue \getcitedata[volume][#2] to \localvolume \getcitedata[spremembe][#2] to \localspremembe \footnote{\localtitle\ (\localkratko), \localjournal, št. \localissue/\localvolume\skip, \localspremembe.}% \egroup}% \setvalue{zakonkratko:#2}{done}}
You can check for content in these macros with:
\doifsomething{\localtitle}{\localtitle} \doifsomethingelse{\localtitle}{\localtitle}{<something else>} \doifnothing{\localtitle}{<no title>} \doifelsenothing{\localtitle}{<no title>}{\localtitle}
Wolfgang
___________________________________________________________________________________ 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________
Dne sreda 3. novembra 2010 ob 11:14:44 je Taco Hoekwater napisal(a):
Adjust the style? Certainly that is easier than the macro solution I see below.
The style is prescribed by the faculty, so that's not really an option. :\ Cheers, Matija -- gsm: +386 41 849 552 www: http://matija.suklje.name xmpp: matija.suklje@gabbler.org
Hi, On 11/03/10 11:23, Matija Šuklje wrote:
Dne sreda 3. novembra 2010 ob 11:14:44 je Taco Hoekwater napisal(a):
Adjust the style? Certainly that is easier than the macro solution I see below.
The style is prescribed by the faculty, so that's not really an option. :\
No I was going to propose to adjust the bibliography style, but if you need it both inline and at the end, that does not work. As Wolfgang wrote already, macros like \doifsomethingelse{\localtitle}{\localtitle}{<something else>} are the most important key to getting the formatting right. Best wishes, Taco
Dne sreda 3. novembra 2010 ob 11:28:08 je Taco Hoekwater napisal(a):
Hi,
On 11/03/10 11:23, Matija Šuklje wrote:
Dne sreda 3. novembra 2010 ob 11:14:44 je Taco Hoekwater napisal(a):
Adjust the style? Certainly that is easier than the macro solution I see below.
The style is prescribed by the faculty, so that's not really an option. :\
No I was going to propose to adjust the bibliography style, but if you need it both inline and at the end, that does not work.
Oh, OK. Will try something there (also Mojca was kind enough to take a look at a full example). Yes, two different citing styles — 1) footnote; 2) end of text — are needed and that complicates the matters immensely.
As Wolfgang wrote already, macros like
\doifsomethingelse{\localtitle}{\localtitle}{<something else>}
are the most important key to getting the formatting right.
Will take a look and bug you if I don't figure it out, thanks. Cheers, Matija -- gsm: +386 41 849 552 www: http://matija.suklje.name xmpp: matija.suklje@gabbler.org
participants (5)
-
Hans Hagen
-
Matija Šuklje
-
Mojca Miklavec
-
Taco Hoekwater
-
Wolfgang Schuster