Nested / Compounded roles: apply multiple roles to overlapping text

大城市里の小女人 提交于 2019-12-08 19:47:52

问题


In my custom.css file I have,

.bold {
    font-weight: bold;
}

.red {
    color:red;
}

And in my _.rst file,

.. role:: bold

.. role:: red

But if I try to nest/compound them, only the outermost role takes effect, e.g.


:bold:`:red:`This is only bold``

This is only bold


Is there a way to combine these effects without defining a new (combined) role?


回答1:


you can use a custom css class directive:

.. cssclass:: boldred

  bold red text

and update the css to format the boldred class




回答2:


Roles are defined that the can not be nested.

Neither HTML nor LaTeX, as backends, support overlapping of styles.



来源:https://stackoverflow.com/questions/43162240/nested-compounded-roles-apply-multiple-roles-to-overlapping-text

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!