1"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[1413],{10291:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>o,default:()=>h,frontMatter:()=>r,metadata:()=>a,toc:()=>l});var s=t(85893),i=t(11151);const r={sidebar_position:47,description:"You can have very fine-grained control over the content depending on the current subslide by using #alternatives-fn.",toc_max_heading_level:2},o="alternatives-fn",a={id:"reference/utils/alternatives-fn",title:"alternatives-fn",description:"You can have very fine-grained control over the content depending on the current subslide by using #alternatives-fn.",source:"@site/docs/reference/utils/alternatives-fn.mdx",sourceDirName:"reference/utils",slug:"/reference/utils/alternatives-fn",permalink:"/docs/reference/utils/alternatives-fn",draft:!1,unlisted:!1,tags:[],version:"current",sidebarPosition:47,frontMatter:{sidebar_position:47,description:"You can have very fine-grained control over the content depending on the current subslide by using #alternatives-fn.",toc_max_heading_level:2},sidebar:"tutorialSidebar",previous:{title:"alternatives",permalink:"/docs/reference/utils/alternatives"},next:{title:"alternatives-cases",permalink:"/docs/reference/utils/alternatives-cases"}},c={},l=[{value:"start : <TypeLink></TypeLink> <Default><code>1</code></Default>",id:"start",level:3},{value:"end : <TypeLink></TypeLink> | <TypeLink></TypeLink> <Default><code>none</code></Default>",id:"end",level:3},{value:"count : <TypeLink></TypeLink> | <TypeLink></TypeLink> <Default><code>none</code></Default>",id:"count",level:3},{value:"position : <TypeLink></TypeLink>",id:"position",level:3},{value:"stretch : <TypeLink></TypeLink>",id:"stretch",level:3}];function d(e){const n={a:"a",code:"code",h1:"h1",h3:"h3",p:"p",strong:"strong",...(0,i.a)(),...e.components},{Default:t,Param:r,Parameters:o,Signature:a,SignatureName:c,SignatureParam:l,SourceLink:d,TypeLink:h}=n;return t||u("Default",!0),r||u("Param",!0),o||u("Parameters",!0),a||u("Signature",!0),c||u("SignatureName",!0),l||u("SignatureParam",!0),d||u("SourceLink",!0),h||u("TypeLink",!0),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.h1,{id:"alternatives-fn",children:"alternatives-fn"}),"\n",(0,s.jsx)(a,{children:(0,s.jsxs)("code",{children:[(0,s.jsx)(c,{children:"alternatives-fn"}),"(",(0,s.jsxs)(l,{children:[(0,s.jsx)(n.a,{href:"#self",children:"self: none"}),", "]}),(0,s.jsxs)(l,{children:[(0,s.jsx)(n.a,{href:"#start",children:"start: 1"}),", "]}),(0,s.jsxs)(l,{children:[(0,s.jsx)(n.a,{href:"#end",children:"end: none"}),", "]}),(0,s.jsxs)(l,{children:[(0,s.jsx)(n.a,{href:"#count",children:"count: none"}),", "]}),(0,s.jsxs)(l,{children:[(0,s.jsx)(n.a,{href:"#kwargs",children:"..kwargs"}),", "]}),(0,s.jsx)(l,{children:(0,s.jsx)(n.a,{href:"#fn",children:"fn"})}),")",(0,s.jsx)(d,{href:"https://github.com/touying-typ/touying/blob/main/src/utils.typ#L2384"})]})}),"\n",(0,s.jsx)(n.p,{children:"You can have very fine-grained control over the content depending on the current subslide by using #alternatives-fn. It accepts a function (hence the name) that maps the current subslide index to some content."}),"\n",(0,s.jsxs)(n.p,{children:["Example: ",(0,s.jsx)(n.code,{children:'#alternatives-fn(start: 2, count: 7, subslide => { numbering("(i)", subslide) })'})]}),"\n",(0,s.jsxs)(o,{children:[(0,s.jsxs)(n.h3,{id:"start",children:["start : ",(0,s.jsx)(h,{type:"int"})," ",(0,s.jsx)(t,{children:(0,s.jsx)(n.code,{children:"1"})})]}),(0,s.jsx)(r,{children:(0,s.jsxs)(n.p,{children:["The starting subslide number. Default is ",(0,s.jsx)(n.code,{children:"1"}),"."]})}),(0,s.jsxs)(n.h3,{id:"end",children:["end : ",(0,s.jsx)(h,{type:"int"})," | ",(0,s.jsx)(h,{type:"none"})," ",(0,s.jsx)(t,{children:(0,s.jsx)(n.code,{children:"none"})})]}),(0,s.jsx)(r,{children:(0,s.jsxs)(n.p,{children:["The ending subslide number. Default is ",(0,s.jsx)(n.code,{children:"none"}),"."]})}),(0,s.jsxs)(n.h3,{id:"count",children:["count : ",(0,s.jsx)(h,{type:"int"})," | ",(0,s.jsx)(h,{type:"none"})," ",(0,s.jsx)(t,{children:(0,s.jsx)(n.code,{children:"none"})})]}),(0,s.jsx)(r,{children:(0,s.jsxs)(n.p,{children:["The number of subslides. Default is ",(0,s.jsx)(n.code,{children:"none"}),"."]})}),(0,s.jsxs)(n.h3,{id:"position",children:["position : ",(0,s.jsx)(h,{type:"alignment"})]}),(0,s.jsx)(r,{children:(0,s.jsxs)(n.p,{children:["The alignment of alternatives within the reserved space. Default is ",(0,s.jsx)(n.code,{children:"bottom + left"}),"."]})}),(0,s.jsxs)(n.h3,{id:"stretch",children:["stretch : ",(0,s.jsx)(h,{type:"bool"})]}),(0,s.jsx)(r,{children:(0,s.jsxs)(n.p,{children:["Whether to stretch all alternatives to the maximum width and height. Default is ",(0,s.jsx)(n.code,{children:"false"}),". Important: If you use a zero-length content like a context expression, you should set ",(0,s.jsx)(n.code,{children:"stretch: false"}),"."]})})]}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.strong,{children:"Returns:"})," ",(0,s.jsx)(h,{type:"content"})]})]})}function h(e={}){const{wrapper:n}={...(0,i.a)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(d,{...e})}):d(e)}function u(e,n){throw new Error("Expected "+(n?"component":"object")+" `"+e+"` to be defined: you likely forgot to import, pass, or provide it.")}},11151:(e,n,t)=>{t.d(n,{Z:()=>a,a:()=>o});var s=t(67294);const i={},r=s.createContext(i);function o(e){const n=s.useContext(r);return s.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:o(e.components),s.createElement(r.Provider,{value:n},e.children)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.