-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
Description
How can I parse optional arguments of environments in PhpLatex? The following LaTeX:
\begin{tabular}[t]{c}
table content
\end{tabular}
Gets parsed as follows:
object(App\Utility\Latex\Parser\Node) id:0 {
protected _type => 'environ'
protected _props => [
'mode' => (int) 1,
'value' => 'tabular',
]
protected _children => [
(int) 0 => object(PhpLatex_Node) id:1 {
protected _type => 'group'
protected _props => [
'mode' => (int) 1,
'arg' => true,
]
protected _children => [
(int) 0 => object(PhpLatex_Node) id:2 {
protected _type => 'text'
protected _props => [
'mode' => (int) 1,
'value' => '[',
]
protected _children => [ ]
},
]
},
(int) 1 => object(PhpLatex_Node) id:3 {
protected _type => 'text'
protected _props => [
'mode' => (int) 1,
'value' => 't]',
]
protected _children => [ ]
},
(int) 2 => object(PhpLatex_Node) id:4 {
protected _type => 'group'
protected _props => [
'mode' => (int) 1,
]
protected _children => [
(int) 0 => object(PhpLatex_Node) id:5 {
protected _type => 'text'
protected _props => [
'mode' => (int) 1,
'value' => 'c',
]
protected _children => [ ]
},
]
},
(int) 3 => object(PhpLatex_Node) id:6 {
protected _type => 'text'
protected _props => [
'mode' => (int) 1,
'value' => ' table content ',
]
protected _children => [ ]
},
]
}
Possible Solution
Would I need to do the following?
- Get the first child
- Check the
'arg' => true
prop - See it has a child of type
text
with value'['
- Check the following children until one contains a text node containing the character
']'
- Check following child nodes for whether they are also arguments
Is it not possible to parse these args in Parser::_parseArg
?
Additional Context
No response
Metadata
Metadata
Assignees
Labels
No labels