Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- begin{description}
- item[foo] foo is good
- item[bar] bar is bad
- end{description}
- begin{description}
- item[foo] label{foo} foo is good
- ....
- end{description}
- ....
- For good things (see, for example ref{foo})...
- newcounter{desccount}
- newcommand{descitem}[1]{%
- item[#1] refstepcounter{desccount}label{#1}
- }
- newcommand{descref}[1]{hyperref[#1]{#1}}
- begin{description}
- descitem{foo} foo is good
- descitem{bar} bar is bad
- end{description}
- ...
- For good things (see, for example descref{foo})...
- newcounter{foobarcounter}
- renewcommand{thefoobarcounter}
- {({ifcasevalue{foobarcounter}or fooor barelse ehhhfirelax})}
- begin{list}{thefoobarcounter}{usecounter{foobarcounter}}
- itemlabel{foodesc} Foo is good
- item Bar is bad
- item This list was not supposed to be this long
- end{list}
- ......
- .. Something good, see ref{foodesc}.
- usepackage{amsmath}
- ...
- begin{equation}label{eq:energy}tag{Einstein}
- E=mc^2
- end{equation}
- ...
- Invoking the energy-mass equivalence of ref{eq:energy}
- newcommand{foo}{foo}
- ....
- begin{description}
- item[foo] foo is good
- ....
- end{description}
- ....
- For good things (see, for example foo)...
- newcounter{foocnt} %% define a counter
- setcounter{foocnt}{0} %% set the counter to some initial value (not really important)
- %%%% Parameters
- % #1: Title
- newenvironment{fooEnvironment}[1]
- {
- renewcommand{thefoocnt}{textbf{#1}} %% this is where the display of the counter is overwritten/modified
- refstepcounter{foocnt} %% increment counter (in this case we write the custom label/title to a temp. file which is read when the document resolves a ref)
- par %% start new paragraph (this is just an example for format modifications)
- textbf{#1:} %% display the title before the content of the environment is displayed
- }{
- par %% another paragraph after the environment
- }
- begin{fooEnvironment}{foo}
- foo is good
- label{fooLabel}
- end{fooEnvironment}
- begin{fooEnvironment}{bar}
- bar is bad
- label{barLabel}
- end{fooEnvironment}
- For good things (see, for example ref{fooLabel})...
- newcounter{desccount}
- newcommand{descitem}[1]{%
- refstepcounter{desccount}label{#1}%
- }
- newcommand{descref}[2][undefined]{%
- ifx#1undefined%
- hyperref[#2]{#2}%
- else%
- hyperref[#2]{#1}%
- fi%
- }%
- descitem{linklabel} text next to label, you will be directed here...
- newpage
- descref[after clicking on this optional text]{linklabel}
- documentclass{article}
- usepackage{hyperref}
- begin{document}
- makeatletter
- newcommandmy@saved@item{}
- newcommandmydescriptionitem{}
- defmydescriptionitem[#1]{%
- my@saved@item[{csname phantomsectionendcsname#1}]%
- def@currentlabel{unexpanded{unexpanded{#1}}}%
- }%
- newenvironment{mydescription}%
- {%
- letmy@saved@item@item
- let@item=mydescriptionitem
- description
- }%
- {csname enddescriptionendcsname}
- makeatother
- begin{mydescription}
- item[foo] label{foo} foo is good
- item[bar] label{bar} bar is bad
- end{mydescription}
- For good things (see, for example ref{foo})dots
- For bad things (see, for example ref{bar})dots
- end{document}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement