-1

For short, I got this

\usepackage{tocloft}

{\renewcommand{\cftsecfont}{\rmfamily}}

which sets the section family font in TOC, and I need a scalebox-like command to narrow the section font on TOC. The only thing I can conceive is a sort of the dummy \rescale below.

{\renewcommand{\cftsecfont}{\rescale\rmfamily}}

I tried all the ways inserting the line inside the \scalebox{} and \scalebox{0.5}[1.0]{\rmfamily}, neither of which worked.

Actualization: As Werner said, here is a section in my TOC breaking across lines, which I wish to narrow, but as of the code above, I can't select the text to narrow it from the style, so I need a command that doesn't create a new environment. Let's say a

{\narrower some text} 

rather than a

\narrower{some text}

enter image description here

Also, using \section[\rescale{0.5}[1.0]{Title}]{Title} didn't work.

  • Others may disagree, but I'm not seeing enough of your question to understand what's going on. Why do you need to rescale? Can you create a Minimal Working Example that shows where you need to rescale? Is it an option to use a smaller font for the TOC? Is it an option to use a shorter title for the TOC? – Teepeemm Jan 3 '20 at 14:57
  • 1
    \scalebox{0.5}[1.0] would leave the text virtually unreadable in most fonts, what is the problem that you are needing to solve? there must be a better solution. – David Carlisle Jan 3 '20 at 16:13
  • What about: \renewcommand{\cftsecfont}{\footnotesize}? And maybe some other fonts such as \renewcommand{\cftsecpagefont}{\footnotesize}. – Peter Wilson Jan 3 '20 at 17:37
  • IIRC, each font size level is about 0.86 less than the previous one, so 0.86^4=0.55 and 0.86^5=0.47. – John Kormylo Jan 3 '20 at 18:11
  • 1
    You can compress the font using microtype, i.e. use a negative tracking factor, see section 5.3 in the manual. – Sveinung Jan 7 '20 at 17:31
1
\usepackage{tocloft}
\renewcommand{\cftsecfont}{\footnotesize}

will use \footnotesize for the section title text, thus not taking up as much horizontal space. However I think that that might look a little peculiar.

Have you thought of using the optional argument to \section to give a shorter title in the ToC and header?

\section[short title in ToC]{long title in the text}

ADDENDUM

I really don't understand what the OP is after in relation to the ToC. However in a comment he says "I want to narrow a text...". In relation to the ToC (and LoF and LoT) the space available for the title is given by \linewidth - indent - numwidth - \@tocrmarg --- see figure 1 in the tocloft documentation (> texdoc tocloft).

To reduce the space allotted to titles then increase \@tocrmarg (default 2.55em) by;

\makeatletter
\renewcommand{\@tocrmarg}{10em} % choose length to suit
\makeatother
  • Resizing the text keeping scale is not quite what my question is about... I really want to narrow a text inside an environment using a command which doesn't create another environment. – Aquiles Jan 6 '20 at 22:09
  • @Aquiles You have expanded the question since my answer. I do not understand what you are after (it doesn't seem to have anything special to do with the ToC). Perhaps you could post another clearer question about your problem in general and what you are wanting to solve. What is the use case? – Peter Wilson Jan 8 '20 at 19:05
  • @Aquiles I have extended my answer although I'm not really clear about what your general problem is. – Peter Wilson Jan 9 '20 at 19:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.