0

I need to edit the following code to get this desired output

enter image description here

instead of

enter image description here

\documentclass{article}

\usepackage{ragged2e, siunitx}

\DeclareSIUnit{\radpers}{\radian\s\tothe{-1}}

\usepackage{collcell}

\newcolumntype{s}{>{\collectcell\unit}c<{\endcollectcell}}

\makeatletter
\expandafter\renewcommand\expandafter*\expandafter
{\csname NC@rewrite@s\endcsname}[1][]%
{%
    \@temptokena\expandafter
    {%
        \the\@temptokena
        >{\collectcell\unit}c<{\endcollectcell}%
    }%
    \NC@find
}
\makeatother

\begin{document}
\begin{tabular}{
        s[
        inter-unit-product = \ensuremath{{\cdot}},
        table-unit-alignment = left,
        per-mode = symbol,
        bracket-unit-denominator,
        sticky-per,
        forbid-literal-units,
        ]}
    \N\m\per\radpers \\
\end{tabular}
\end{document}

Here is the log file

This is LuaHBTeX, Version 1.14.0 (MiKTeX 21.8) (format=lualatex 2021.9.12)  12 SEP 2021 17:29
 system commands enabled.
 file:line:error style messages enabled.
**texstudio_ZiqyeR.tex
(./texstudio_ZiqyeR.tex
LaTeX2e <2021-06-01> patch level 1
Lua module: luaotfload 2021-05-21 3.18 Lua based OpenType font support
Lua module: lualibs 2021-05-20 2.74 ConTeXt Lua standard libraries.
Lua module: lualibs-extended 2021-05-20 2.74 ConTeXt Lua libraries -- extended c
ollection.
luaotfload | conf : Root cache directory is "C:/Users/Diaa/AppData/Local/MiKTeX/
2.9/luatex-cache/generic/names".
luaotfload | init : Loading fontloader "fontloader-2021-05-20.lua" from kpse-res
olved path "C:/Program Files/MiKTeX 2.9/tex/luatex/luaotfload/fontloader-2021-05
-20.lua".
Lua-only attribute luaotfload@noligature = 1
Lua-only attribute luaotfload@syllabe = 2
luaotfload | init : Context OpenType loader version 3.116
Inserting `luaotfload.node_processor' at position 1 in `pre_linebreak_filter'.
Inserting `luaotfload.node_processor' at position 1 in `hpack_filter'.
Inserting `luaotfload.glyph_stream' at position 1 in `glyph_stream_provider'.
Inserting `luaotfload.define_font' at position 1 in `define_font'.
Lua-only attribute luaotfload_color_attribute = 3
luaotfload | conf : Root cache directory is "C:/Users/Diaa/AppData/Local/MiKTeX/
2.9/luatex-cache/generic/names".
Inserting `luaotfload.harf.strip_prefix' at position 1 in `find_opentype_file'.
Inserting `luaotfload.harf.strip_prefix' at position 1 in `find_truetype_file'.
Inserting `luaotfload.harf.finalize_vlist' at position 1 in `post_linebreak_filt
er'.
Inserting `luaotfload.harf.finalize_hlist' at position 2 in `hpack_filter'.
Inserting `luaotfload.cleanup_files' at position 1 in `wrapup_run'.
Inserting `luaotfload.harf.finalize_unicode' at position 1 in `finish_pdffile'.
Inserting `luaotfload.glyphinfo' at position 1 in `glyph_info'.
Lua-only attribute luaotfload.letterspace_done = 4
Inserting `luaotfload.aux.set_sscale_dimens' at position 1 in `luaotfload.patch_
font'.
Inserting `luaotfload.aux.set_font_index' at position 2 in `luaotfload.patch_fon
t'.
Inserting `luaotfload.aux.patch_cambria_domh' at position 3 in `luaotfload.patch
_font'.
Inserting `luaotfload.aux.fixup_fontdata' at position 1 in `luaotfload.patch_fon
t_unsafe'.
Inserting `luaotfload.aux.set_capheight' at position 4 in `luaotfload.patch_font
'.
Inserting `luaotfload.aux.set_xheight' at position 5 in `luaotfload.patch_font'.
Inserting `luaotfload.rewrite_fontname' at position 6 in `luaotfload.patch_font'
. L3 programming layer <2021-08-27>
Inserting `tracingstacklevels' at position 1 in `input_level_string'.
("C:/Program Files/MiKTeX 2.9/tex/latex/base/article.cls"
Document Class: article 2021/02/12 v1.4n Standard LaTeX document class
("C:/Program Files/MiKTeX 2.9/tex/latex/base/size10.clo"
File: size10.clo 2021/02/12 v1.4n Standard LaTeX file (size option)
luaotfload | db : Font names database loaded from C:/Users/Diaa/AppData/Local/Mi
KTeX/2.9/luatex-cache/generic/names/luaotfload-names.luc)
\c@part=\count179
\c@section=\count180
\c@subsection=\count181
\c@subsubsection=\count182
\c@paragraph=\count183
\c@subparagraph=\count184
\c@figure=\count185
\c@table=\count186
\abovecaptionskip=\skip47
\belowcaptionskip=\skip48
\bibindent=\dimen138
)
("C:/Program Files/MiKTeX 2.9/tex/latex/ragged2e/ragged2e.sty"
Package: ragged2e 2021/02/05 v3.0 ragged2e Package
\CenteringLeftskip=\skip49
\RaggedLeftLeftskip=\skip50
\RaggedRightLeftskip=\skip51
\CenteringRightskip=\skip52
\RaggedLeftRightskip=\skip53
\RaggedRightRightskip=\skip54
\CenteringParfillskip=\skip55
\RaggedLeftParfillskip=\skip56
\RaggedRightParfillskip=\skip57
\JustifyingParfillskip=\skip58
\CenteringParindent=\skip59
\RaggedLeftParindent=\skip60
\RaggedRightParindent=\skip61
\JustifyingParindent=\skip62
)
("C:/Program Files/MiKTeX 2.9/tex/latex/siunitx/siunitx.sty"
Package: siunitx 2021-08-27 v3.0.28 A comprehensive (SI) units package
\l__siunitx_angle_tmp_dim=\dimen139
\l__siunitx_angle_marker_box=\box50
\l__siunitx_angle_unit_box=\box51
\l__siunitx_compound_count_int=\count187

("C:/Program Files/MiKTeX 2.9/tex/latex/translations/translations.sty"
Package: translations 2021/01/17 v1.10a internationalization of LaTeX2e package
s (CN)

("C:/Program Files/MiKTeX 2.9/tex/latex/etoolbox/etoolbox.sty"
Package: etoolbox 2020/10/05 v2.5k e-TeX tools for LaTeX (JAW)
\etb@tempcnta=\count188
)
("C:/Program Files/MiKTeX 2.9/tex/generic/pdftexcmds/pdftexcmds.sty"
Package: pdftexcmds 2020-06-27 v0.33 Utility functions of pdfTeX for LuaTeX (HO
)

("C:/Program Files/MiKTeX 2.9/tex/generic/infwarerr/infwarerr.sty"
Package: infwarerr 2019/12/03 v1.5 Providing info/warning/error messages (HO)
)
("C:/Program Files/MiKTeX 2.9/tex/generic/iftex/iftex.sty"
Package: iftex 2020/03/06 v1.0d TeX engine tests
)
("C:/Program Files/MiKTeX 2.9/tex/generic/ltxcmds/ltxcmds.sty"
Package: ltxcmds 2020-05-10 v1.25 LaTeX kernel commands for general use (HO)
)
Package pdftexcmds Info: \pdf@primitive is available.
Package pdftexcmds Info: \pdf@ifprimitive is available.
Package pdftexcmds Info: \pdfdraftmode found.
\pdftexcmds@toks=\toks16
))
\l__siunitx_number_exponent_fixed_int=\count189
\l__siunitx_number_min_decimal_int=\count190
\l__siunitx_number_min_integer_int=\count191
\l__siunitx_number_round_precision_int=\count192
\l__siunitx_number_group_minimum_int=\count193

("C:/Program Files/MiKTeX 2.9/tex/latex/amsmath/amstext.sty"
Package: amstext 2000/06/29 v2.01 AMS text

("C:/Program Files/MiKTeX 2.9/tex/latex/amsmath/amsgen.sty"
File: amsgen.sty 1999/11/30 v2.0 generic functions
\@emptytoks=\toks17
\ex@=\dimen140
))
("C:/Program Files/MiKTeX 2.9/tex/latex/graphics/color.sty"
Package: color 2020/02/24 v1.2b Standard LaTeX Color (DPC)

("C:/Program Files/MiKTeX 2.9/tex/latex/graphics-cfg/color.cfg"
File: color.cfg 2016/01/02 v1.6 sample color configuration
)
Package color Info: Driver file: luatex.def on input line 149.

("C:/Program Files/MiKTeX 2.9/tex/latex/graphics-def/luatex.def"
File: luatex.def 2021/06/01 v1.2c Graphics/color driver for luatex
))
\l__siunitx_table_tmp_box=\box52
\l__siunitx_table_tmp_dim=\dimen141
\l__siunitx_table_column_width_dim=\dimen142
\l__siunitx_table_integer_box=\box53
\l__siunitx_table_decimal_box=\box54
\l__siunitx_table_before_box=\box55
\l__siunitx_table_after_box=\box56
\l__siunitx_table_before_dim=\dimen143
\l__siunitx_table_carry_dim=\dimen144
\l__siunitx_unit_tmp_int=\count194
\l__siunitx_unit_position_int=\count195
\l__siunitx_unit_total_int=\count196

("C:/Program Files/MiKTeX 2.9/tex/latex/l3packages/l3keys2e/l3keys2e.sty"
("C:/Program Files/MiKTeX 2.9/tex/latex/l3kernel/expl3.sty"
Package: expl3 2021-08-27 L3 programming layer (loader) 

("C:/Program Files/MiKTeX 2.9/tex/latex/l3backend/l3backend-luatex.def"
File: l3backend-luatex.def 2021-08-04 L3 backend support: PDF output (LuaTeX)
\l__color_backend_stack_int=\count197
\l__pdf_internal_box=\box57
))
Package: l3keys2e 2021-08-27 LaTeX2e option processing using LaTeX3 keys
)
("C:/Program Files/MiKTeX 2.9/tex/latex/tools/array.sty"
Package: array 2021/04/20 v2.5e Tabular extension package (FMi)
\col@sep=\dimen145
\ar@mcellbox=\box58
\extrarowheight=\dimen146
\NC@list=\toks18
\extratabsurround=\skip63
\backup@length=\skip64
\ar@cellbox=\box59
))
("C:/Program Files/MiKTeX 2.9/tex/latex/collcell/collcell.sty"
Package: collcell 2011/02/27 v0.5 Collect the content of a tabular cell
\collect@cell@count=\count198
)
Package translations Info: No language package found. I am going to use `englis
h' as default language. on input line 24.

No file texstudio_ZiqyeR.aux.

\openout1 = texstudio_ZiqyeR.aux
LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line 24.
LaTeX Font Info:    ... okay on input line 24.
LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line 24.
LaTeX Font Info:    ... okay on input line 24.
LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line 24.
LaTeX Font Info:    ... okay on input line 24.
LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 24.
LaTeX Font Info:    ... okay on input line 24.
LaTeX Font Info:    Checking defaults for TS1/cmr/m/n on input line 24.
LaTeX Font Info:    Trying to load font information for TS1+cmr on input line 2
4.
("C:/Program Files/MiKTeX 2.9/tex/latex/base/ts1cmr.fd"
File: ts1cmr.fd 2019/12/16 v2.5j Standard LaTeX font definitions
)
LaTeX Font Info:    ... okay on input line 24.
LaTeX Font Info:    Checking defaults for TU/lmr/m/n on input line 24.
LaTeX Font Info:    ... okay on input line 24.
LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line 24.
LaTeX Font Info:    ... okay on input line 24.
LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 24.
LaTeX Font Info:    ... okay on input line 24.

("C:/Program Files/MiKTeX 2.9/tex/latex/translations/dicts/translations-basic-d
ictionary-english.trsl"
File: translations-basic-dictionary-english.trsl (english translation file `tra
nslations-basic-dictionary')
)
Package translations Info: loading dictionary `translations-basic-dictionary' f
or `english'. on input line 24.

("C:/Program Files/MiKTeX 2.9/tex/context/base/mkii/supp-pdf.mkii"
[Loading MPS to PDF converter (version 2006.09.02).]
\scratchcounter=\count199
\scratchdimen=\dimen147
\scratchbox=\box60
\nofMPsegments=\count266
\nofMParguments=\count267
\everyMPshowfont=\toks19
\MPscratchCnt=\count268
\MPscratchDim=\dimen148
\MPnumerator=\count269
\makeMPintoPDFobject=\count270
\everyMPtoPDFconversion=\toks20
)
LaTeX Font Info:    External font `cmex10' loaded for size
(Font)              <7> on input line 25.
LaTeX Font Info:    External font `cmex10' loaded for size
(Font)              <5> on input line 25.
 [1

{C:/Users/Diaa/AppData/Local/MiKTeX/2.9/pdftex/config/pdftex.map}]
(./texstudio_ZiqyeR.aux))

Here is how much of LuaTeX's memory you used:
 5442 strings out of 478146
 100000,460012 words of node,token memory allocated
 486 words of node memory still in use:
   3 hlist, 1 vlist, 1 rule, 2 glue, 3 kern, 1 glyph, 4 attribute, 64 glue_spec,
 4 attribute_list, 1 write nodes
   avail lists: 2:57,3:13,4:8,5:24,6:2,7:80,8:11,9:40
 25703 multiletter control sequences out of 65536+600000
 33 fonts using 3269615 bytes
 73i,8n,77p,233b,544s stack positions out of 5000i,500n,10000p,200000b,80000s
<//?/c:/program files/miktex 2.9/fonts/opentype/public/lm/lmroman10-regular.otf>
<C:/Program Files/MiKTeX 2.9/fonts/type1/public/amsfonts/cm/cmr10.pfb><C:/Progra
m Files/MiKTeX 2.9/fonts/type1/public/amsfonts/cm/cmr7.pfb><C:/Program Files/MiK
TeX 2.9/fonts/type1/public/amsfonts/cm/cmsy7.pfb>
Output written on texstudio_ZiqyeR.pdf (1 page, 28852 bytes).

PDF statistics: 25 PDF objects out of 1000 (max. 8388607)
 0 named destinations out of 1000 (max. 131072)
 1 words of extra memory for PDF output out of 10000 (max. 100000000)

7
  • 1
    I get N·m·s/rad
    – egreg
    Sep 11 at 22:44
  • You can get the desired output with \DeclareSIUnit{\radpers}{(\radian\cdot\s\tothe{-1})} \DeclareSIUnit{\Nm}{\N\cdot\m} and then use{}\Nm \per\radpers in the cell. (for some reason, \collectcell\unit does not want to see \Nm as the first thing in the cell, thus the addition of {}. Not sure if this meets your need. Sep 12 at 18:20
  • @StevenB.Segletes That's just forcing literal mode: one could do that lots of ways
    – Joseph Wright
    Sep 12 at 21:08
  • @JosephWright Yes, I know it is literal mode. It depends if the OP wants an elegant solution or just something to get out of a bind. Obviously, you are the maker of elegant siunitx solutions, not I. Sep 12 at 21:19
  • @StevenB.Segletes I already made it with literate inputting. I need to get it done programmatically as I did with the siunitx v2.
    – Diaa
    Sep 13 at 8:58

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.