GithubHelp home page GithubHelp logo

subpar's Introduction

subpar

Subpar is a Typst package for creating sub figures.

#import "@preview/subpar:0.1.1"

#set page(height: auto)
#set par(justify: true)

#subpar.grid(
  figure(image("/assets/andromeda.jpg"), caption: [
    An image of the andromeda galaxy.
  ]), <a>,
  figure(image("/assets/mountains.jpg"), caption: [
    A sunset illuminating the sky above a mountain range.
  ]), <b>,
  columns: (1fr, 1fr),
  caption: [A figure composed of two sub figures.],
  label: <full>,
)

Above in @full, we see a figure which is composed of two other figures, namely @a and @b.

ex

Contributing

Contributions are most welcome, make sure to let others know you're working on something beforehand so no two people waste their time working on the same issue. It's recommended to have typst-test installed to run tests locally.

Documentation

A guide and API-reference for subpar can be found in it's manual.

subpar's People

Contributors

tingerrr avatar

Stargazers

David Holtz avatar Alberto Fabbri avatar Abdulaziz Alqasem avatar  avatar NickAc avatar BPY avatar Janosh Riebesell avatar Moin avatar Jonas Goldhammer avatar Kevin K. avatar James R Swift avatar _ivaquero_ avatar Csimide avatar Edgar Onghena avatar

Watchers

 avatar

subpar's Issues

If inside the main figure's caption, don't prefix subfigure ref with figure ref

i'd like to not prefix the subfigure counter with the main figure when referencing from within the main figure's caption. in this example

#import "@preview/subpar:0.1.0"

#subpar.grid(
  figure(image("/assets/andromeda.jpg"), caption: [
    An image of the andromeda galaxy.
  ]), <a>,
  figure(image("/assets/mountains.jpg"), caption: [
    A sunset illuminating the sky above a mountain range.
  ]), <b>,
  columns: (1fr, 1fr),
  caption: [A figure composed of two sub figures, @a and @b],
  label: <full>,
)

i'm trying to get the caption

A figure composed of two sub figures, a) and b)

instead of

A figure composed of two sub figures, Figure 1a and Figure 1b

Related comment

Multi-language support

Currently, the supplement of a super-figure is set to "Figure" explicitly, because it cannot be resolved by user code in the show rule in order to apply it to its children regardless of their kind.

Better support for resolving auto values in typst itself or better native i18n support like in typst#3728 could solve this.

Alternatively, the linguify package or my unfinished translation package could be used to provide translations.

Supplement will not resolve within the elements context

When using propagate-supplement: true, we use a mirror implementation of the built-in supplement resolver, but this cannot resolve the context in which an element is referred to, leading to incorrect references if used in a multilingual document.

A current workaround is setting propagate-supplement to false and specifying the supplement for all sub figures manually.

How to align first line of captions?

Hi,

I'm really excited about subpar, I jumped on it as soon as I saw the first version was released!

I'm trying it out on a project of mine and I see the figure captions are aligned nicely, but the result looks a bit off to my taste:

2024-05-03T13_23_53_screenshot

In this case it would make more sense to me if the captions' first lines were aligned.

Do you have any suggestions on how I could achieve this, or would it have to be integrated into subpar?

Relative numbering is incorrect for super-figures

In order to allow relative numbering, the numbering would be set to a function which evaluates the another counter and appends the actual figure number. This works with normal figures and sub-figures, but not with super-figures.

This is because the ref show rule must be adjusted to use the correct figure number itself.

Something like typst#3930 could solve this by explicitly providing the location at which the numbering function should be evaluated, the same way outline and ref do it on their own already.

But perhaps the counters could be stepped differently, such that the ref show rule is not required.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.