PageSourceSearch

https://touying-typ.github.io/assets/js/a5f84cbb.00af4db0.js

js touying-typ.github.io collected 2026-10-03 10:06:35 UTC 6,016 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[1798],{73222:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>a,contentTitle:()=>o,default:()=>h,frontMatter:()=>i,metadata:()=>c,toc:()=>l});var s=t(85893),r=t(11151);const i={sidebar_position:24,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",c={id:"reference/core/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/core/alternatives-fn.mdx",sourceDirName:"reference/core",slug:"/reference/core/alternatives-fn",permalink:"/docs/reference/core/alternatives-fn",draft:!1,unlisted:!1,tags:[],version:"current",sidebarPosition:24,frontMatter:{sidebar_position:24,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/core/alternatives"},next:{title:"alternatives-cases",permalink:"/docs/reference/core/alternatives-cases"}},a={},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> <Default><code>bottom + left</code></Default>",id:"position",level:3},{value:"stretch : <TypeLink></TypeLink> <Default><code>false</code></Default>",id:"stretch",level:3}];function d(e){const n={a:"a",code:"code",h1:"h1",h3:"h3",p:"p",strong:"strong",...(0,r.a)(),...e.components},{Default:t,Param:i,Parameters:o,Signature:c,SignatureName:a,SignatureParam:l,SourceLink:d,TypeLink:h}=n;return t||u("Default",!0),i||u("Param",!0),o||u("Parameters",!0),c||u("Signature",!0),a||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)(c,{children:(0,s.jsxs)("code",{children:[(0,s.jsx)(a,{children:"alternatives-fn"}),"(",(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:"#position",children:"position: bottom + left"}),", "]}),(0,s.jsxs)(l,{children:[(0,s.jsx)(n.a,{href:"#stretch",children:"stretch: false"}),", "]}),(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/core.typ#L2062"})]})}),"\n",(0,s.jsxs)(n.p,{children:["You can have very fine-grained control over the content depending on the current subslide by using ",(0,s.jsx)(n.code,{children:"#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)(i,{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:"none"})," | ",(0,s.jsx)(h,{type:"int"})," ",(0,s.jsx)(t,{children:(0,s.jsx)(n.code,{children:"none"})})]}),(0,s.jsx)(i,{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:"none"})," | ",(0,s.jsx)(h,{type:"int"})," ",(0,s.jsx)(t,{children:(0,s.jsx)(n.code,{children:"none"})})]}),(0,s.jsx)(i,{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)(t,{children:(0,s.jsx)(n.code,{children:"bottom + left"})})]}),(0,s.jsx)(i,{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)(t,{children:(0,s.jsx)(n.code,{children:"false"})})]}),(0,s.jsx)(i,{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,r.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:()=>c,a:()=>o});var s=t(67294);const r={},i=s.createContext(r);function o(e){const n=s.useContext(i);return s.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function c(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),s.createElement(i.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.