Creates a table from a dictionary; optionally with a header. If no label AND no caption are given this method returns a LaTeX tabular snippet. Else it returns a table snippet. :param dct: Dictionary with key-value pairs. :type circuitObject: dict
(self, dct, head=None, label="", caption="")
| 163 | return Snippet(RST, self.format) |
| 164 | |
| 165 | def dictTable(self, dct, head=None, label="", caption=""): |
| 166 | """ |
| 167 | Creates a table from a dictionary; optionally with a header. |
| 168 | If no label AND no caption are given this method returns a LaTeX |
| 169 | tabular snippet. Else it returns a table snippet. |
| 170 | |
| 171 | :param dct: Dictionary with key-value pairs. |
| 172 | :type circuitObject: dict |
| 173 | |
| 174 | :param head: List with names for the key column and the value column, respectively. |
| 175 | List items will be converted to string. |
| 176 | :type head: list |
| 177 | |
| 178 | :param label: Reference label for the table. Defaults to an empty string. |
| 179 | :type label: str |
| 180 | |
| 181 | :param caption: Text that will used as table caption. |
| 182 | :type caption: str |
| 183 | |
| 184 | :return: SLiCAP Snippet object |
| 185 | :rtype: SLiCAP.SLiCAPprotos.Snippet |
| 186 | """ |
| 187 | RST = None |
| 188 | if len(dct.keys()) > 0: |
| 189 | if type(head) == list and len(head) == 2: |
| 190 | headerList = [str(head[0]), str(head[1])] |
| 191 | else: |
| 192 | headerList = ["", ""] |
| 193 | linesList = [] |
| 194 | for key in dct.keys(): |
| 195 | line = [key, ":math:`" + sp.latex(roundN(dct[key])) + "`" ] |
| 196 | linesList.append(line) |
| 197 | RST = _RSTcreateCSVtable(caption, headerList, linesList, |
| 198 | label=label) |
| 199 | return Snippet(RST, self.format) |
| 200 | |
| 201 | def params(self, circuitObject, label="", caption=""): |
| 202 | """ |
no test coverage detected