Code Monkey home page Code Monkey logo

Comments (7)

cgnieder avatar cgnieder commented on August 15, 2024

Original comment by Robin Schneider (Bitbucket: ypid, GitHub: ypid).


I found a workaround:

#!latex
\makeatletter%
\let\acro@patch@org@acl\acl\relax
\let\acro@patch@org@ac\ac\relax
\renewcommand{\acl}[1]{\acro@patch@org@acl{#1}\acuse{#1}\xspace}
\renewcommand{\ac}[1]{\acro@patch@org@ac{#1}\acuse{#1}\xspace}
\makeatother%

from acro.

cgnieder avatar cgnieder commented on August 15, 2024

Original comment by Robin Schneider (Bitbucket: ypid, GitHub: ypid).


To answer the question why one would use acronyms in math mode. That is a little hack I came up with to use acronyms in source code listings with the minted package and the option mathescape :)

from acro.

cgnieder avatar cgnieder commented on August 15, 2024

Original comment by Clemens Niederberger (Bitbucket: cgnieder, GitHub: cgnieder).


Interesting...

#!latex

\documentclass{article}
\usepackage{amsmath,acro}

\DeclareAcronym{test}{short=test,long=a test entry}
\DeclareAcronym{foo}{short=foo,long=bar}

\begin{document}
\printacronyms%

text
$\text{\ac{test}}$
text
$\ac{foo}$
text

\end{document}

from acro.

cgnieder avatar cgnieder commented on August 15, 2024

Original comment by Clemens Niederberger (Bitbucket: cgnieder, GitHub: cgnieder).


Obviously \mathchoice is the bad guy here:

#!latex

\documentclass{article}
\usepackage{acro}

\DeclareAcronym{test}{short=test,long=a test entry}
\DeclareAcronym{foo}{short=foo,long=bar}

\newcommand\mytext[1]{\mathchoice{#1}{#1}{#1}{#1}}

\begin{document}
\printacronyms%

text
$\mytext{\ac{test}}$
text
$\ac{foo}$
text

\end{document}

from acro.

cgnieder avatar cgnieder commented on August 15, 2024

Original comment by Clemens Niederberger (Bitbucket: cgnieder, GitHub: cgnieder).


The problem with \mathchoice is that the contents of all four arguments is typeset and stored before TeX decides which of the four to use. In the case of \text this means that \ac{test} is typeset four times before actually used by TeX. By then it is marked as used as far as acro as concerned but the aux file contains no information about this: the line

#!latex

\acro@used@once{test}{1}{1}{1}

is missing. When \ac{test} is finally used the line

#!latex

\acro@used@twice{test}{1}{1}{1}

is inserted instead. I'm not sure there is much I can do about this...

from acro.

cgnieder avatar cgnieder commented on August 15, 2024

Original comment by Clemens Niederberger (Bitbucket: cgnieder, GitHub: cgnieder).


Removing version: 1.6 (automated comment)

from acro.

cgnieder avatar cgnieder commented on August 15, 2024

Original comment by Clemens Niederberger (Bitbucket: cgnieder, GitHub: cgnieder).


\mathchoice is a TeX primitive. There isn't much that can be done about the behaviour. A workaround with and care by the user is needed

from acro.

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.