LaTeX forum ⇒ GeneralDatabase, List, References Topic is solved

LaTeX specific issues not fitting into one of the other forums of this category.
srosendal
Posts: 4
Joined: Thu Nov 16, 2017 1:34 pm

Database, List, References

Postby srosendal » Thu Nov 16, 2017 1:52 pm

Hi

I would like to create a list with 50 items or so. Each item needs 3 names, for example with

Reference: Number: Item: Description
tag01: 091102S61S01: Push Button: Start sequence
tag02: 091102S61S02: Push Button: Stop sequence
tag03: 091102S61S03: Button Switch: Mode Selector

I want to make references to these, say my text will be:

When operator push /tag01 the machine starts
When operator push /tag02 the machine stops

Actual text should be
When operator push 091102S61S01: Push Button: Start sequence the machine starts
When operator push 091102S61S02: Push Button: Stop sequence the machine stops

I tried with BibTex, but it was not good, too difficult to get the actual text right

Anyone wanna try ? THX

Tags:

User avatar
Stefan Kottwitz
Site Admin
Posts: 8665
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:

Postby Stefan Kottwitz » Thu Nov 16, 2017 4:18 pm

Welcome to the forum!

Perhaps show what you tried. Besides BibTeX, you could use biblatex.

Stefan
Site admin

srosendal
Posts: 4
Joined: Thu Nov 16, 2017 1:34 pm

Postby srosendal » Fri Nov 17, 2017 12:08 pm

Thank you

What I get is:

When operator push 'start sequence' (1s01) the machine starts
When operator push 'stop sequence' (1s02) the machine stops


I want a form like year:title:author

---------------------------------------------------------------------
MY MAIN

\documentclass{article}
\usepackage{natbib}

\title{test}
\author{test}
\date{\today}

\begin{document}
\maketitle
When operator push \citet{tag01} the machine starts\\
When operator push \citet{tag02} the machine stops

\newpage
\bibliographystyle{apalike}
\bibliography{bibliography.bib}

\end{document}

---------------------------------------------------------------------
MY BIBLIOTGAPHY.bib

@book{tag01,
title={push button},
author={'start sequence'},
volume={},
year={091102s61s01},
publisher={}
}
@book{tag02,
title={push button},
author={'stop sequence'},
volume={},
year={091102s61s02},
publisher={}
}

srosendal
Posts: 4
Joined: Thu Nov 16, 2017 1:34 pm

Postby srosendal » Mon Dec 04, 2017 3:30 pm

so, guess it is not that simple afterall :)

User avatar
Stefan Kottwitz
Site Admin
Posts: 8665
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:

Postby Stefan Kottwitz » Mon Dec 04, 2017 3:35 pm

At least I did not use such a method. I can help in troubleshooting stuff, no time for engineering new things.

If you find out something, let us please know. I'm interested.

Stefan
Site admin

User avatar
nlct
Posts: 268
Joined: Thu Nov 06, 2008 11:15 am
Contact:

Postby nlct » Mon Jan 22, 2018 1:12 am

You could try using the glossaries-extra package. For example:
  1. \documentclass{article}
  2.  
  3. \usepackage{longtable}
  4. \usepackage[nostyles]{glossaries-extra}
  5.  
  6. \newcommand*{\newoperation}[4]{%
  7. \newglossaryentry{#1}{name={#2},symbol={#3},description={#4}}%
  8. }
  9. \newcommand*{\operationref}[1]{%
  10. \glsdisp{#1}{\textbf{\glsentryname{#1}: \glsentrysymbol{#1}: `\glsentrydesc{#1}'}}%
  11. }
  12.  
  13. \newoperation{tag01}{091102S61S01}{Push Button}{Start sequence}
  14. \newoperation{tag02}{091102S61S02}{Push Button}{Stop sequence}
  15. \newoperation{tag03}{091102S61S03}{Button Switch}{Mode Selector}
  16.  
  17. \newglossarystyle{operation}{%
  18. \renewenvironment{theglossary}%
  19. {\begin{longtable}{lll}}%
  20. {\end{longtable}}%
  21. \renewcommand*{\glossaryheader}{%
  22. \bfseries Number & \bfseries Item & \bfseries Description\tabularnewline
  23. \endhead
  24. }%
  25. \renewcommand*{\glsgroupheading}[1]{}%
  26. \renewcommand{\glossentry}[2]{%
  27. \glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} &
  28. \glossentrysymbol{##1} & \glossentrydesc{##1}\tabularnewline
  29. }%
  30. \renewcommand{\subglossentry}[3]{\glossentry{##2}{##3}}%
  31. \renewcommand*{\glsgroupskip}{}%
  32. }
  33.  
  34. \begin{document}
  35.  
  36. When operator push \operationref{tag01} the machine starts
  37. When operator push \operationref{tag02} the machine stops
  38.  
  39. \printunsrtglossary[title={List of Operations},style=operation]
  40. \end{document}


This will list the items in the order that they were defined.

Since you already have a .bib file, here's another approach using glossaries-extra with bib2gls. If file "testdata.bib" contains:
  1. @entry{tag01,
  2. operationnumber={091102S61S01},
  3. operationitem={Push Button},
  4. description={Start sequence}
  5. }
  6.  
  7. @entry{tag02,
  8. operationnumber={091102S61S02},
  9. operationitem={Push Button},
  10. description={Stop sequence}
  11. }
  12.  
  13. @entry{tag03,
  14. operationnumber={091102S61S03},
  15. operationitem={Button Switch},
  16. description={Mode Selector}
  17. }

Then the document can be changed to:
  1. \documentclass{article}
  2.  
  3. \usepackage{longtable}% needed for custom style
  4. \usepackage[nostyles,% using a custom style
  5. record% using bib2gls
  6. ]{glossaries-extra}
  7.  
  8. \GlsXtrLoadResources[
  9. src={test-data},% entries defined in test-data.bib
  10. field-aliases={% convert custom field names to keys recognised by glossaries-extra.sty
  11. operationnumber=name,
  12. operationitem=symbol
  13. },
  14. sort=letter-case,% case-sensitive character code sort
  15. sort-field=name% sort by 'name' field (which has been obtained from 'operationnumber')
  16. ]
  17.  
  18. \newcommand*{\operationref}[1]{%
  19. \glsdisp{#1}{\textbf{\glsentryname{#1}: \glsentrysymbol{#1}: \glsentrydesc{#1}}}%
  20. }
  21.  
  22. \newglossarystyle{operation}{%
  23. \renewenvironment{theglossary}%
  24. {\begin{longtable}{lll}}%
  25. {\end{longtable}}%
  26. \renewcommand*{\glossaryheader}{%
  27. \bfseries Number & \bfseries Item & \bfseries Description\tabularnewline
  28. \endhead
  29. }%
  30. \renewcommand*{\glsgroupheading}[1]{}%
  31. \renewcommand{\glossentry}[2]{%
  32. \glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} &
  33. \glossentrysymbol{##1} & \glossentrydesc{##1}\tabularnewline
  34. }%
  35. \renewcommand{\subglossentry}[3]{\glossentry{##2}{##3}}%
  36. \renewcommand*{\glsgroupskip}{}%
  37. }
  38.  
  39. \begin{document}
  40.  
  41. When operator push \operationref{tag01} the machine starts
  42. When operator push \operationref{tag02} the machine stops
  43.  
  44. \printunsrtglossary[title={List of Operations},style=operation]
  45. \end{document}

This only includes the tag01 and tag02 entries in the list, as the default action is to only select the entries that have been referenced in the document. If you want to include all entries defined in the .bib file, then just add selection=all to the resource options:
  1. \GlsXtrLoadResources[
  2. src={test-data},% entries defined in test-data.bib
  3. field-aliases={% convert custom field names to keys recognised by glossaries-extra.sty
  4. operationnumber=name,
  5. operationitem=symbol
  6. },
  7. sort=letter-case,% case-sensitive character code sort
  8. sort-field=name,% sort by 'name' field (which has been obtained from 'operationnumber')
  9. selection=all
  10. ]

The document build process is much the same as with BibTeX but replace bibtex with bib2gls.

Regards
Nicola Talbot

srosendal
Posts: 4
Joined: Thu Nov 16, 2017 1:34 pm

Postby srosendal » Thu Jan 25, 2018 6:26 pm

Thank you very much for your answer, it did help :)


Return to “General”

Who is online

Users browsing this forum: Baidu [Spider], Yahoo [Bot] and 7 guests