How can I control the behavior of formatting(font size, bold, italics, underline, etc...) depending on the depth of a set of nested environments?

That is, I'd like the top level to be bold and huge while the inner most levels to be small and normal.

Some depths will have italics, etc..

Basically the formatting is consistent across the nesting level but I don't want to have to create formatting for every nest manually(since the lists are large with many nesting).

right now I have a ton of formatting macro's. I'd like a sort of CSS approach. e.g.,



(the idea is that I can set the size and other properties(\underlinemode makes all test underline)

the environments naturally revert to the previous styles when exiting an environment

  • Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}.
    – user31729
    Apr 12, 2015 at 20:13
  • It certainly feels like enumitem should be able to handle this with \setlist, but no such option exists. Good question. Note: For a more CSS-like approach, use semantic formatting better: \newcommand\ItemTypeFormat{\Large\underlinemode}. Apr 12, 2015 at 20:18
  • @SeanAllred But the whole issue is that the formatting changes depending on the depth. Because of the large lists I have to specify a lot of macro's. This becomes very tedious and is not easily manageable. Apr 12, 2015 at 20:21
  • Rest assured that I understand what you're going after, I'm merely suggesting another layer of indirection. Apr 12, 2015 at 20:22

1 Answer 1


With enumitem it is easy to add code to some list depth:



\item blub
  \item blblb
\item blabla 
  • Thanks, it does have some nice features and probably will do what I need. I have a problem: How to specify bold like textbf without having to specify the text. e.g., setlist[1]{before=\textbf} does not make the text bold. (because \textbf wants an argument. Apr 12, 2015 at 21:28
  • @user4780446 before=\bfseries
    – egreg
    Apr 12, 2015 at 21:41
  • Thanks, Now I need to underline but see no underline series equivalent. (I have to specify this stuff in the setlist macro and since ther eis no argument I have to use argumentless macro's... yet these don't seem to be too common. Apr 12, 2015 at 22:16
  • Underlining won't work in this setup: There is no switch for underline. And if you would try to tweak the list so that it passes its content to ul or ulem: it would be very fragile. The only safe solution is a dedicated "underlined" font - you could create it as virtual font with fontinst but it is not easy. Apr 13, 2015 at 8:12

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.