cgnieder / acro

acronyms for LaTeX
LaTeX Project Public License v1.3c
40 stars 9 forks source link

Displaying in list: Long acronyms or many usages posing problems #207

Closed Lozik closed 3 years ago

Lozik commented 3 years ago

When using long acronyms (or rather long 'long forms') or if a certain acronym is used on many different pages, the acronym listing behaves in a way that does not really please me. These images explain my issue better:

Screenshot 2021-02-14 at 01 10 25 Screenshot 2021-02-14 at 01 10 12

It seems to me that there are two issues (although, correlated):

Is there any current solution? Is this a known issue that someone has solved? Or is this a fixable bug?

Thanks :)

cgnieder commented 3 years ago

It is not a bug. But a behavior that can be changed.

The manual of the current version of acro describes the option pages/fill as This is the code that is placed between acronym description and actual page numbers. It is initially set to \acrodotfill. The latter is described as Creates a dotted line like those in the table of contents. If the macro \cftdotfill is defined it is equal to \cftdotfill{\cftdotsep}.

From the image you posted I assume that your version is older. In versions 3.0 up to but not including 3.3 the option was initially set to \dotfill. In version prior to v3.0 there was no option IIRC.

You didn't supply a minimal example but I guess that setting \acsetup{pages/fill=\allowbreak\acrodotfill} (or \acsetup{pages/fill=\allowbreak\dotfill}) should help.

It would be interesting to see if a current version of acro (which uses \acrodotfill) actually still shows the behavior.

Lozik commented 3 years ago

Thanks for your prompt response. You were right, I was not using the latest version, I was using 56982 (3.3). However, with the newest version, it is exactly the same. I tried your settings, but the results were absolutely the same.

So here is a 'minimal' (not) working example with its result:

\documentclass{article}

\usepackage{acro}
\usepackage[paper=a4paper, right = 2.5cm, left = 3.5cm]{geometry}

\DeclareAcronym{a}{
  short = BREACH,
  long = Browser Reconnaissance and Exfiltration via Adaptive Compression of Hypertext aaaaa,
}
\DeclareAcronym{b}{
  short = BREACH,
  long = Browser Reconnaissance and Exfiltration via Adaptive Compression of Hypertext aa,
}
\DeclareAcronym{c}{
  short = BREACH,
  long = Browser Reconnaissance and Exfiltration via Adaptive Compression of Hypertext aaa,
}
\DeclareAcronym{d}{
  short = BREACH,
  long = Browser Reconnaissance and Exfiltration via Adaptive Compression of Hypertext a,
}

\acsetup{
  pages/display = all,
}

\begin{document}
    \ac{a}
    \ac{b}
    \ac{c}
    \ac{d}
    \newpage
    a
    \newpage
    \ac{d}
    \newpage
    \printacronyms
\end{document}

Screenshot 2021-02-17 at 15 16 05

cgnieder commented 3 years ago

The result looks exactly like I would expect it too look. I'm not entirely sure what you want this to look like. Maybe like this:

image

Or rather like this:

image

The code for both is the following (just remove the \mbox{} to get the second outcome):

\documentclass{article}
\usepackage[paper=a4paper, right = 2.5cm, left = 3.5cm,showframe]{geometry}
\usepackage{acro}

\acsetup{
  pages/fill = \penalty-50\space\mbox{}\acrodotfill
}

\DeclareAcronym{a}{
  short = BREACH,
  long = Browser Reconnaissance and Exfiltration via Adaptive Compression of
    Hypertext aaaaa
}
\DeclareAcronym{b}{
  short = BREACH,
  long = Browser Reconnaissance and Exfiltration via Adaptive Compression of
    Hypertext aa
}
\DeclareAcronym{c}{
  short = BREACH,
  long = Browser Reconnaissance and Exfiltration via Adaptive Compression of
    Hypertext aaa 
}
\DeclareAcronym{d}{
  short = BREACH,
  long = Browser Reconnaissance and Exfiltration via Adaptive Compression of
    Hypertext a 
}
\DeclareAcronym{e}{
  short = xx,
  long = short example
}

\acsetup{
  pages/display = all,
}

\begin{document}

\ac{a} \ac{b} \ac{c} \ac{d} \ac{e}

\newpage
a
\newpage
\ac{d}
\newpage
\printacronyms

\end{document}

Or rather like this?

image

The same code as above but with

\acsetup{
  pages/fill = { \acrodotfill}
}
Lozik commented 3 years ago

I have to admit that I wouldn't have expected (intuitively) the default to look like your third example. What I would have (and what I would wish my list to look like) would be your first proposition. However, depending on the long form of the acronym, this is not the result with your proposed pages/fill value.

I would use \space\penalty-70\mbox{}\acrodotfill. That way, there is always a space in front of the page number and single page numbers/orphans are prevented.

As I said, IMHO that would have been the way I expected it to work but well, the essential part is that one can change the behaviour :)

Thanks for your help!

cgnieder commented 3 years ago

Penalties are not an exact science usually :)

Lozik commented 3 years ago

Yes, I recon :P However what was very useful, was to put the space before the penalty so there is never a situation with LongAcronymLongForm2 (with 2 the page number of course).