GithubHelp home page GithubHelp logo

Label capitalisation about multimarkdown-4 HOT 4 CLOSED

fletcher avatar fletcher commented on June 14, 2024
Label capitalisation

from multimarkdown-4.

Comments (4)

fletcher avatar fletcher commented on June 14, 2024

You're doing two different things. The label you specify in [Chapter_introduction] is converted to a valid anchor label (stripping out illegal characters), and is converted to lower case. This is normal MMD behavior.

When you manually specify a URL, MMD doesn't alter it (why would it?) --- [foo](bar) or [foo](#bar).

If you want to reference a MMD label, simply use that syntax --- [Chapter_Introduction].

from multimarkdown-4.

janrito avatar janrito commented on June 14, 2024

I am aware of the difference. But that behaviour is not always the desired one. Maybe the above example does not illustrate what I mean correctly.

Consider this:

Introduction [Chapter_Introduction]
-----------------------------------

...

In [Chapter_Introduction] we introduce a mathematical model for unwelcome opinions.

Currently, multimarkdown will translate that into:

\chapter{Introduction}
\label{chapter_introduction}

{\ldots}

In Chapter\_Introduction (\autoref{chapter_introduction}) we introduce a mathematical model for unwelcome opinions.

Which, once processed with latex, keeps the Chapter_Introduction label.

Chapter 1. Introduction

...

In Chapter_Introduction (Chapter 1) we introduce a mathematical model for unwelcome opinions.

In MultiMarkdown 3 and up to MultiMarkdown 4.2, but excluding the current HEAD, the original label is not capitalised. Which allows for the desired behaviour. So this:

Introduction [Chapter_Introduction]
-----------------------------------

...

In [](#Chapter_Introduction) we introduce a mathematical model for unwelcome opinions.

will be transformed into this:

\chapter{Introduction}
\label{Chapter_Introduction}

{\ldots}

In \autoref{Chapter_Introduction} we introduce a mathematical model for unwelcome opinions.

which, once processed with latex, becomes:

Chapter 1. Introduction

...

In Chapter 1 we introduce a mathematical model for unwelcome opinions.

This is a change in behaviour from previous versions, which could deal with this case.

from multimarkdown-4.

fletcher avatar fletcher commented on June 14, 2024

Yes -- so this is a different question. Key is to think about what each structure is:

[foo][bar]

uses foo in the text body, and looks for a label named bar. MMD will look for a label that matches the proper case, but in the setting of headers the actual "anchor" text (HTML term, but LaTeX is analogous) will be lower case.

[foo][foo]
[foo]

are the same as [foo][bar], but it just so happens that the text you want and the label you are using are the same. So the second version is just a shortcut of the first version.

[foo](http://bar.com/)
[foo](#bar)

is different. The second version says make a URL/link using foo as the text, but #bar as the target URL. This structure assumes you know what you are linking to, and does what you say.

What you want is:

[][bar]

or

[][Chapter_Introduction]

This says "link to the thing labelled Chapter_Introduction, but don't add any additional text."

from multimarkdown-4.

janrito avatar janrito commented on June 14, 2024

Right. Thank you.

I guess in the previous versions it worked because the heading label wasn't changed into lowercase.

The confusion might also be because the [](#label) form is the only way to reference figures, as the [][label] form includes a footnote with the name of the image file, not a reference to the figure, as if it was a regular link to a url.

![this is a figure instead][Figure]

[][Figure] is a diagram of the model.

[Figure]: fig.png "" width="100%"

is transformed into:

\begin{figure}[htbp]
\centering
\includegraphics[keepaspectratio,width=1.0000\textwidth,height=0.75\textheight]{fig.png}
\caption{this is a figure instead}
\label{figure}
\end{figure}

\href{fig.png}{}\footnote{\href{fig.png}{fig.png}} is a diagram of the model.

which results into

[inserted figure]

^1 is a diagram of the model.

--------------
1. ought.png

Whereas

![this is a figure instead][Figure]

[](#Figure) is a diagram of the model.

[Figure]: fig.png "" width="100%"

used to output:

\begin{figure}[htbp]
\centering
\includegraphics[keepaspectratio,width=$.4f\textwidth,height=0.75\textheight]{fig.png}
\caption{this is a figure instead}
\label{Figure}
\end{figure}

\autoref{Figure} is a diagram of the model.

and then:

[inserted figure]

Figure 1 is a diagram of the model.

but in the current HEAD, \label{Figure} is lowercase (\label{figure}), which means that autoref won't pick up the reference correctly.

P.S. I just realised that I made a mistake in the previous post. Where it says:

In MultiMarkdown 3 and up to MultiMarkdown 4.2, but excluding the current HEAD, the original label is not capitalised.

It should say:

In MultiMarkdown 3 and up to MultiMarkdown 4.2, but excluding the current HEAD, the original label is left untouched. The current head, changes the label to lowercase.

from multimarkdown-4.

Related Issues (20)

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.