For the university I am composing a document of only definitions, containing all the definitions of difficult terms that I encounter while studying. The document actually is a large set of description environments, separated only by the sections that group the entries according to the chapters of the reference book. Moreover I am inserting many clickable links that refer to various items of the text, both because some terms have a very widespread synonym (which therefore I have to insert as a separate item but that actually refers only to the main term) and because, sometimes, in the text of a definition I use a term which is then explained in another entry and which is therefore convenient to link with a clickable link.

Since each term is unique and all are inserted inside the square brackets typical of the description environments, it is possible to create a command that, with a simple syntax like \go_to{term_xy}, tells LaTeX to connect to the only point of the source where is the string [term_xy]? Thus the creation of the interlinks would be greatly facilitated, above all because I could avoid replacing the already compiled entries with \hypertarget{term_xy}{term_xy}.

Below is an example of how I create links now:

item [\hypertarget{peptidoglycan}{Peptidoglycan}] definition...
other items ...
item [Murein] see $rightarrow$ \hyperlink{peptidoglycan}{peptidoglycan}

I'm open also for advices that bypass the problem

  • 2
    The solution presented here: tex.stackexchange.com/a/293/134144 should also work for your case. – leandriis Apr 29 '19 at 18:24
  • Thanks! The answer you linked me is very useful, sorry if I haven't seen it previously. But is there any way to make the \descref{} command case-insensitive? Since all the \descitem{} begins with capital letter and I always have to reference to them in the middle of a definition (where the lowercase letter is required), I think it would be great if I can cross-reference regardless of upper or lower case. – andreagoo8 Apr 30 '19 at 14:18
  • @andreagoo8: I think the easiest way is to NOT play around with the labels but with the commands. First, if all the \descitem{}s are going to be capitalized, you can make sure to always type the label with lower case initials but use the mfirstuc package to capitalize the first letter when displaying the term. And then you can also define \Descref{} which will print the term with capitalization using the same trick. – Willie Wong Apr 30 '19 at 14:38
  • Thanks for the answer! It works great. One last problem that i hadn't detected yet: sometimes I have to put some words of the label in italic (but not all). Any ideas? – andreagoo8 May 2 '19 at 15:07
  • Sorry but I'm new to Stack Exchange, and I don't know if I should edit the question rather than write here in the comments – andreagoo8 May 2 '19 at 15:11

Your Answer

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

Browse other questions tagged or ask your own question.