3

Note: The following MWE has no significance in use or further application of any kind rather than just for experimenting with the packages explicitly written on the question title.

enter image description here

\documentclass{article}
\usepackage{xparse}
\ExplSyntaxOn
\dim_new:N \l_shcstyle_instruction_length
\dim_set:Nn \l_shcstyle_instruction_length { 8em }

\box_new:N \l_shcstyle_bullet_box
\hbox_set:Nn \l_shcstyle_bullet_box { \textbullet\  } 

\NewDocumentCommand{\mybulletpar}{ m }
 {
    \parbox{\dim_use:N \l_shcstyle_instruction_length}
     {
      \hbox_overlap_left:n 
       { 
        %\box_move_up:nn { 0ex }
         %{
          \box_use:N \l_shcstyle_bullet_box 
         %}
       } 
      #1
     }
 }
\ExplSyntaxOff

\begin{document}
This is a \mybulletpar{some random text used to test newcommand}

\end{document}

So I have been toying around with some of the LaTeX 3 packages, especially l3box and l3skip since they seemed easy to understand, but what am not sure is of their proper usage and implementation in commands. For example, the MWE above I created a new dimension; I suppose I named it correctly by putting it local. After which, I set its size to 8em. Then I created a box and used it to set the contents of an hbox. Nothing hard so far. I then tried to use the \hbox_overlap_left:n { box } command to somewhat act like an \llap{<content>}. (Am not really sure if it is its proper use.) But note that when I use the box I created \box_use:N \l_shcstyle_bullet_box, it creates an empty line. Weird? I honestly am just experimenting on this.

Any insights and corrections of naming, usage or other sample implementations of the commands would help me better understand LaTeX 3. Note that interface3 only provides some descriptions of the commands.

I am also interested in seeing how to use the following commands:

  • \box_move_right:nn {<dimexpr>} {<box function>}
  • \box_move_left:nn {<dimexpr>} {<box function>}

and those commands involving - \vbox:n {<contents>}

  • 1
    At the start of the parbox, TeX is in vertical mode. In this mode, it will stack boxes vertically, and in particular the (horizontal) box created by \hbox_overlap_left:n is placed entirely above the paragraph of text which follows. Add \leavevmode before \hbox_overlap_left:n to go to horizontal mode: then the bullet and the following text will be considered as a single paragraph. – Bruno Le Floch Feb 17 '14 at 16:40
  • @BrunoLeFloch Is there a LaTeX 3 equivalent to \leavevmode? Thanks by the way. The implementation of \leavevmode was my last resort. :-) Also how can you tell when it is in vertical mode? – azetina Feb 17 '14 at 16:42
  • 2
    @azetina AFAIK there isn't. Something like \cs_new_protected:Npn \my_leave_vmode: { \hbox_unpack:N \c_empty_box } would work but why not simply use \leavevmode? – clemens Feb 17 '14 at 19:01
  • @cgnieder I have nothing against \leavevmode. It's just that am trying to gain as much as I can from learning LaTeX 3. At the moment no one has made any suggestions as to how I defined my commands and if am using the syntax correctly. Thanks for the input on \my_leave_vmode. – azetina Feb 17 '14 at 19:05

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.